Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap: Using btn-block with split dropdown-toggle buttons</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css" rel="stylesheet">
@Encosia
Encosia / jQuery-Deferred-chaining.js
Created February 4, 2014 02:52
I have a page that uses $.Deferred to simultaneously load data and its corresponding template, but the template that should be used depends on something rendered on the DOM. So, I need to wait until $(document).ready() to query that and load the appropriate template. Trying to figure out the cleanest way to return a promise out of the getTemplat…
var getTemplate = function() {
var dfd = $.Deferred();
// Need to wait on the DOM to be ready to determine which template to use.
$(document).ready(function() {
var conditionalThing = $('#some-selector').is('.foobar'),
templateUrl;
if (conditionalThing)
templateUrl = 'template1.htm';
@Encosia
Encosia / gist:3797507
Created September 28, 2012 01:40
One of the worst-targeted recruiter emails I've received in quite a while.
09/27/12 9:39 AM
Dear David,
My name is Shamika and I'm a recruiter at Axelon Services Corporation. We have your resume on file and I thought you may be interested in an opportunity we currently have available for a Service Assurance Engineer with a major Telecommunications company located in ATLANTA, GA.
@Encosia
Encosia / gist:3301296
Created August 9, 2012 05:24 — forked from glennblock/gist:3297118
Create counts for modules by category from nodejs.org module wiki
var nom = require('nom');
var categories = [ ];
nom('http://github.com/joyent/node/wiki/modules', function(err, $) {
$('#wiki-body h1:eq(1)~h2~h3').each(function() {
categories.push({
name: $(this).text(),
count: $(this).next().find('a').length
})
});
@Encosia
Encosia / presentationPrep.js
Created April 6, 2012 22:18 — forked from JeffreyWay/presentationPrep.js
I wish it could be that simple. Something for me to build.
presentation({
title: 'My Great Presentation',
slides: [{
title: 'Learn About Borders',
bullets: [
'Thing 1',
'Thing 2',
],
code: ['path/to/file.css', [2,4]] // path to file, lines to grab
@Encosia
Encosia / _invoice.tpl.htm
Created August 18, 2011 03:11
Remote template loading with jQuery Templates
<script id="invoiceTemplate" type="x-jquery-tmpl">
<table class="invoice">
<thead>
<tr>
<th>Service/Item</th>
<th>Price</th>
<th>Qty</th>
</tr>
</thead>
<tbody>
@Encosia
Encosia / noop-question-voting-nag.user.js
Created June 30, 2011 21:40
Userscript to noop the annoying Stack Overflow "You haven't voted on questions in a while" nag.
// ==UserScript==
// @match http://stackoverflow.com/*
// ==/UserScript==
function exec(fn) {
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = '(' + fn + ')();';
document.body.appendChild(script);
document.body.removeChild(script);