JSFiddle

  • Grid Builder

    js and css. (no jquery)

    function buildGrid(numRows, numCols, rHeight, cHeight) {
        var rowHeight = rHeight || Math.floor((window.innerHeight || document.documentElement.offsetHeight) / numRows);
        var colWidth = cHeight ...
  • Google Maps JS - Detection

    Source: http://tech.bellycard.com/blog/where-d-the-water-go-google-maps-water-pixel-detection-with-canvas/

    $(function(){
       var latlon = "40.7300694,-74.0024224"; // Sample Lat,Long (Manhattan NYC)
    	var distance_between_people = 40; // Keep 40 pixels between people ...
  • Horizontally align divs #75 is the latest revision

    No-Library (pure JS), HTML, CSS, JavaScript

    <div id="start" class="side">
        <span>1</span>
        <span>Lower</span>
    </div>
    <div id="range"></div>
    <div id="end" class="side">
        <span>10</span>
        <span>Higher</span>
    </div>
  • Win8 Fix - Line up Textarea #9 is the latest revision

    jQuery 1.6.4, HTML, CSS, JavaScript

    $("textarea[name='thing']").focus(function() {
        $(this).css( 'margin-bottom', '500px' );
        window.location.hash = '#prompt';
    });
    
    $("textarea[name='thing']").focusout(function() {
        $(this).css ...
  • JS Unique IDs

    No-Library (pure JS), HTML, CSS, JavaScript

    var universe = {};
    (function() {
        var usedIDs = {};
        var id = 0;
    
        var Orangutan = function(params) {
            
            var _uniqueId = function(params.id) {
                if(typeof this ...
  • Grid Builder #2 is the latest revision

    js and css. (no jquery)

    function buildGrid(numRows, numCols) {
        var rowHeight = Math.floor((window.innerHeight || document.documentElement.offsetHeight) / numRows);
        var colWidth = Math.floor((window.innerWidth ...
  • Notch - Minecraft tunneling render #23 is the latest revision

    HN - http://news.ycombinator.com/item?id=4862830 -- I've renamed variables to make sense.

    var ctx;
    var pixels;
    
    var w = 212 * 2;
    var h = 120 * 2;
    
    var map = new Array(64 * 64 * 64);
    var ...
  • Split Centered Columns #1 is the latest revision

    Mootools 1.4.5, HTML, CSS, JavaScript

            <div class="container">
        <div class="title row">
            <h1>Split centered columns</h1>
        </div>
        <div class="row">
            <div class="left half">
                <div class="box">1</div>           
            </div>
            <div class="right half">
                <div class="box">2</div>
            </div>
        </div>
        <div class="row">
            <div class="left half">
                <div class="box">3</div>           
            </div>
            <div class="right half">
                <div class="box">4</div>
            </div>
        </div>
        <div class="row">
            <div class="left half">
                <div class="box">5</div>           
            </div>
            <div class="right half">
                <div class="box">6</div>
            </div>
        </div>
        </div>
  • Odd JS Syntax things #3 is the latest revision

    jQuery 1.8.3, HTML, CSS, JavaScript

    console.log($);
    $ = undefined; // Reset $ to not be jquery
    console.log($);
    var thing = (function($) {
        $("h1").css('color','#188DCC');
    })(jQuery);
    console.log($);
    
  • Auto Scrollbar

    Displays horizontal scrollbar when width < 400px

    <div class="container">
        <h1>Space Ship</h1>
        <div class="leftcol">
    
            <h1> Cookies </h1>
    
        </div>
        <div class="rightcol">
    
            <h1> Paper </h1>
    
        </div>
    </div>