cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js"></script>

<section id="gitRepos"></section>
<aside>Stats from September 14th, 2013 (not up to date)</aside>
<script type="text/x-handlebars-template" id="table-template">
    <table class="table">
        <thead>
            <tr>
                <th>Repo</th>
                <th>Watchers</th>
                <th>Forks</th>
                <th>Size</th>
                <th>Open Issues</th>
                <th>Owner</th>
            </tr>
        </thead>
        <tbody>
            {{#each repos}}
            <tr>
                <td><a href="{{repo.html_url}}" target="_blank">{{name}}</a></td>
                <td>{{watchers}}</td>
                <td>{{forks}}</td>
                <td>{{size}}</td>
                <td>{{open_issues}}</td>
                <td><a href="{{owner.html_url}}" title="Repo owner" target="_blank">{{owner.login}}</a></td>
            </tr>
            {{/each}}
        </tbody>
    </table>
</script>
<script type="text/x-handlebars-template" id="card-template">
        {{#each repos}}
        <article class="card">
            <header>
                <h1><a href="{{html_url}}" target="_blank">{{name}}</a></h1>
                <h2>owned by <a href="{{owner.html_url}}" title="Repo owner" target="_blank">{{owner.login}}</a></h2>
            </header>
            <dl>
                <dt>Watchers</dt><dd>{{watchers}}</dd>
                <dt>Forks</dt><dd>{{forks}}</dd>
                <dt>Size</dt><dd>{{size}}</dd>
                <dt>Open Issues</dt><dd>{{open_issues}}</dd>
            </dl>
        </article>
        {{/each}}
</script>
            
          
!
            
              @import compass

@import compass/reset
@import compass/css3

$breakpoint: 44.375em

* 
    box-sizing: border-box

body
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif
    color: #33393b
    @media (max-width: $breakpoint)
        background-color: #eee
a
    text-decoration: none
    color: #005075
    font-weight: bold
.table
    width: 100%
thead
    font-size: 1.2em
    background-color: #8cbf26
    color: #1f2e3a
    padding-top: .5em
    text-align: left //not sure why but this is necessary in codepen otherwise everything's centered.
th
    font-weight: bold
tbody
    font-size: 1.1em
    tr:nth-child(even)
        background-color: #F1F1F1
tr
    line-height: 2em
    td:first-child, th:first-child
        text-indent: 1em
aside
    margin: 1.6em 1em
    color: #555
    font-style: italic

.card
    margin: 1em .8em
    padding: 1em
    border-radius: .1875em
    border: 1px solid #e2e2e2
    // border: 1px solid #8CBF26
    +box-shadow(#E2E2E2 0 2px)
    // +box-shadow(#8CBF26 0 2px)
    background-color: #fff
    a
        color: #8CBF26
    h1
        font-size: 1.6em
        margin: .25em 0 .4em
    h2
        font-size: 1.2em
        margin: .7em 0 .5em
    dl
        overflow: hidden
        width: 100%
        padding: .2em
        margin-top: 1em
    dt, dd
        float: left
        width: 25%
        line-height: 1.2em
        margin: .3em 0
    dt
        color: #5E6D74
        font-weight: bold
        padding-right: .5em
            
          
!
            
              var repos = [{"name":"bootstrap","owner":{"html_url":"https://github.com/twbs","login":"twbs"},"html_url":"https://github.com/twbs/bootstrap","size":"64893","forks":"20018","open_issues":"159","watchers":"58229"},{"name":"node","owner":{"html_url":"https://github.com/joyent","login":"joyent"},"html_url":"https://github.com/joyent/node","size":"380079","forks":"4731","open_issues":"633","watchers":"24526"},{"name":"jquery","owner":{"html_url":"https://github.com/jquery","login":"jquery"},"html_url":"https://github.com/jquery/jquery","size":"22400","forks":"4899","open_issues":"7","watchers":"23630"},{"name":"html5-boilerplate","owner":{"html_url":"https://github.com/h5bp","login":"h5bp"},"html_url":"https://github.com/h5bp/html5-boilerplate","size":"73410","forks":"5422","open_issues":"8","watchers":"22283"},{"name":"rails","owner":{"html_url":"https://github.com/rails","login":"rails"},"html_url":"https://github.com/rails/rails","size":"220428","forks":"6557","open_issues":"741","watchers":"19587"}];
// Normally a Backbone Model would be used to fetch data

var ResponsiveView = Backbone.View.extend({
    mqlListener: function (mql, matchedTemplate, unmatchedTemplate) {
        if (mql.matches) {
            this.template = matchedTemplate;
        } else {
            this.template = unmatchedTemplate;
        }
        this.render();
    },
    initialize: function (options) {
        var matchedTemplate = options.matchedTemplate,
            unmatchedTemplate = options.unmatchedTemplate;
        if (window.matchMedia) {
            this.mql = window.matchMedia("("+options.breakpoint+")");
            this.mql.addListener(_.bind(this.mqlListener, this, this.mql, matchedTemplate, unmatchedTemplate));
            this.mqlListener(this.mql, matchedTemplate, unmatchedTemplate); //do an initial check when page loads
        } else {
            this.template = matchedTemplate; //IE9 and older
        }
    },
    render: function () {
        var html = this.template({repos: repos});
        this.$el.html(html);
    },
    remove: function () {
        this.mql.removeListener(this.mqlListener);
        Backbone.View.prototype.remove.call(this);
    }
});

$(function () {
    var tableTemplate = Handlebars.compile($('#table-template').html()),
        cardTemplate = Handlebars.compile($('#card-template').html());
    new ResponsiveView({
        el: '#gitRepos',
        breakpoint: 'min-width: 44.375em',
        matchedTemplate: tableTemplate,
        unmatchedTemplate: cardTemplate
    });
});
            
          
!
999px
Loading ..................

Console