View generator.js
// Quote generator for
// Outputs a list of quotes. Choose your favourite and make it an image macro!
function generateQuote(){
for (var $rows=jQuery('table tr'), numrows=$rows.length, phrase=[], i=2;i<=4;i++){
phrase.push( $rows.eq( ~~(Math.random() * numrows) ).find('td:nth-child('+i+')').text().trim() );
return phrase.join(' ');
View rot13.rb
def rot13(word)
alphabet = ('a'..'z').to_a
word.downcase.split('').map do |letter|
index = alphabet.index(letter)
if index >= 13
index -= 13
index += 13
View gist:9843631
// Does not match against already-encoded HTML entities (e.g. &amp;)
View gist:8969418
Considering conspicuous conduct concerning constant congregation confessions, Contra-Conformists confident
Conservative congressmen conversion conspiracy continues, constructing contrived convivial consecrations
connecting controversial contretemps. Consequently, consistent concentrated conflict convulses Connecticut;
Confederates' condos condemned.
View gist:8247479
var a = [];
for (var i in localStorage){
if (localStorage.propertyIsEnumerable(i) && i.indexOf('dataset_')===0){
a.push( i.split('_')[1] );
$('#container').load([location.path, a.join('|')].join('/'));
View gist:7836276
// Convert CamelCase to an under_scored_word
function underscore(s){
return s.replace(/(?!^)([A-Z])/g, function(m){ return '_' + m }).toLowerCase();
View gist:7714414
static function present($object){
$klass= ucfirst(preg_replace_callback('/_([a-z])/',
function($m) { return strtoupper($m[1]);},
$object->type)). 'Presenter';
return new $klass($object);
View drupal_var_fix.php
#!/usr/bin/env drush
# Once it prints the faulty variable names, just re-set the values using `drush vset {variable_name} "{value}"
$variables = db_query('SELECT name, value FROM {variable}')->fetchAllKeyed();
foreach ($variables as $key => $val) {
$v = unserialize($val);
if ($v === FALSE && $val !== 'b:0;') {
View gist:6833135
div { font-family: Helvetica, Arial, sans-serif; width: 50%;}
ol li {
list-style-type: none;
counter-increment: li;
margin-bottom: 0.5em;
margin-left: 3em;
ol li:before {
content: counter(li);
position: relative;
View css_URIs.js
$.each(document.styleSheets, function() {
this.href ? console.log(this.href) : $.map(this.cssRules, function(import){ console.log(import.href) })