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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

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.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container">
  <h2 class="text-primary text-center">TwitchIt</h2>
  <div id="appWrapper"></div>

<script id="appContent" type="text/template">
  <!--<input id="search" class='form-control' type="text" placeholder="Search Twitchers"/>
  <div class="btn-group btn-group-justified">
    <label for="tab1" class='btn'>All</label>
    <label for="tab2" class='btn'>Online</label>
    <label for="tab3" class='btn'>Offline</label>
  <div id='allUsersWrapper'></div>

<script id="allUsersContent" type="text/template">
  <ul class="list-unstyled" id='allUsersList'></ul>

<script id="userItem" type="text/template">
  <li class='row user-item'>
    <a href="<%= profileURL %>" target="_blank">
      <div class="col-xs-1">
        <img class='img-circle' width="35" src="<%= profileImg %>"/>
      <b class='col-xs-8'>
        <%= name %><br>
        <i class='text-muted'><%= streamTitle %></i>
      <i class="col-xs-3 glyphicon <%= streamStatus %>"></i>


  max-width: 500px
    background: lightgray
    border: 1px solid #fff
    margin: 15px 0


comeback to this code and optimize performance by removing old rendered views
var clientID = 'pbfubrqgf1h2f7mpp71zxxvve4a7lnh',
    user = 'rlynjb08',
    users = '' + user + '/follows/channels?client_id=' + clientID;

NOTE: instead of listing all users in an array. I'm just getting the list from
my twitch account
var followedUser = Backbone.Model.extend();
var followedUsers = Backbone.Collection.extend({
  model: followedUser,
  url: users
// if returns null, means they are not currently streaming
// if data returns status 422 with message, means user removed their account
var isUserStreaming = Backbone.Model.extend({
  url: function() {
    return this.get('url')

var appTwitchView = Backbone.View.extend({
  el: '#appWrapper',
  template: _.template( $('#appContent').html() ),
  initialize: function() {
  render: function() {
    this.$el.html( this.template );
    this.auv = new allUsersWrapperView({ tabFlag: this.tabFlag });
  events: {
    "click label[for]": 'userStatus'
    //'keyup #search': 'searchList'
  userStatus: function(e) {
    this.tabFlag = e.currentTarget.htmlFor;
  /*searchList: function(e) {
    this.searchFlag =;
    console.log('searching', this.searchFlag);

var allUsersWrapperView = Backbone.View.extend({
  el: '#allUsersWrapper',
  template: _.template( $('#allUsersContent').html() ),
  collection: new followedUsers,
  initialize: function(options) {
    this.tabFlag = options.tabFlag;
    this.$el.html( this.template );
    this.listenTo(this.collection, 'sync', this.render);
  render: function() {
    var items = this.collection.toJSON()[0].follows;
    _.each(items, function(model) {
      * Note:
      var title =,
          logo =,
          url =,
          ajaxCall = '' + title + '?client_id=' + clientID,
          stream = new isUserStreaming;
      stream.set({ url: ajaxCall });
      this.listenTo(stream, 'sync', function(data) {
        var streamStatus = data.toJSON().stream,
            finalData = {
              name: title,
              profileImg: logo,
              profileURL: url,
              streamStatus: (streamStatus === null) ? 'glyphicon-off text-danger' : 'glyphicon-ok text-success',
              streamTitle: (streamStatus !== null) ? data.toJSON() : ''
        var f = new allUsersView({ model: finalData, tabFlag: this.tabFlag });
    }, this);

var allUsersView = Backbone.View.extend({
  el: '#allUsersList',
  template: _.template( $('#userItem').html() ),
  initialize: function(options) {
    this.filter = options.tabFlag;
  filterTab: function() {
    if ( this.filter === undefined || this.filter === 'tab1' ) {
      this.$el.append( this.template( this.model ) );
    if ( this.filter === 'tab2' ) {
      if (this.model.streamStatus === 'glyphicon-ok text-success') {
        this.$el.append( this.template( this.model ) );
    if ( this.filter === 'tab3' ) {
      if (this.model.streamStatus === 'glyphicon-off text-danger') {
        this.$el.append( this.template( this.model ) );

var au = new appTwitchView();