JSFiddle - React, Tailwind, and code Playground

by kachibito

HTML

<p id="type">Intelligist Sample</p>
<div id="demo" class="snippet"></div>

CSS

div{margin:25px;width: 70% ;}
div div{width:100%;margin:0;font-size:12px;}
p{margin:25px;}

JavaScript

/*
 * Intelligist
 * Version 1.0.1
 * http://srobbin.com/jquery-plugins/intelligist/
 *
 * a jQuery plugin that makes it easy to share multiple, executable GitHub gists
 *
 * Copyright (c) 2012 Scott Robbin (srobbin.com)
 * Licensed under the MIT license.
*/

;(function($){
    
    $.fn.intelligist = function( gists, options ){
        // If we passed in too few elements
        if( this.length == 0 || $.isEmptyObject(gists) ) return;
                
        var $el = $(this[0]) // Only apply to one element
          , $body = $('body')
          , $gist = $('<div />').appendTo( $el )
          , $sandbox = $('<div />').appendTo( $el ).css({ position: 'absolute', left: -999999 })
          , gistCount = ( $.map(gists, function(id) { return id; }) ).length
          , selectedGist;
          
        // Default settings
        var settings = {
            exec: false                                 // Should we execute the gist after it's loaded?
          , before: function( oldGistId, newGistId ) {}   // Function to execute before gist is loaded
          , after: function( newGistId ) {}               // Function to execute after gist is loaded
        }
                
        // Extend the settings with those the user has provided
        if(options && typeof options == 'object') $.extend(settings, options);
                
        // If jQuery Chosen isn't available, download it
        if( !('chosen' in $.fn) && gistCount > 1 ) {
            var chosenScript = 'http://srobbin.github.com/chosen/chosen.jquery.min.js'
              , chosenCSS = 'http://srobbin.github.com/chosen/chosen.css';
            
            // Fetch Chosen's script and styles
            $('<link />').attr({
                rel: 'stylesheet'
              , type: 'text/css'
              , href: chosenCSS
            }).appendTo( $el );
            $.getScript(chosenScript, _init);
        } else {
            _init();
        }
        
        // Init
        function _init()...