Skip to content

Instantly share code, notes, and snippets.

/**
* supplant() does variable substitution on the string. It scans through the string looking for
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object,
* and if the key has a string value or number value, it is substituted for the bracket expression
* and it repeats.
*
* Written by Douglas Crockford
* http://www.crockford.com/
*/
String.prototype.supplant = function (o) {
@eveevans
eveevans / README.md
Created September 12, 2013 18:38 — forked from netmute/README.md

Game of Life

An implementation of Conway's Game of Life in 140 characters of Ruby.

Author

Created by Simon Ernst (@sier).

@eveevans
eveevans / gist:6530487
Created September 11, 2013 22:10
Person in ....
# current_account.posts.visible_to(current_user)
module Visible
extend ActiveSupport::Concern
module ClassMethods
def visible_to(person)
where \
"(#{table_name}.bucket_id IN (?) AND
#{table_name}.bucket_type = 'Project') OR
(#{table_name}.bucket_id IN (?) AND
@eveevans
eveevans / gist:6529318
Created September 11, 2013 20:27
TurboBla
$(function() {
initPage();
});
$(window).bind('page:change', function() {
initPage();
})
@eveevans
eveevans / gist:6300736
Created August 21, 2013 21:54
Ruby dependencies for Ubuntu
apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev
@eveevans
eveevans / gist:4128132
Created November 21, 2012 21:56
Put 'unicorn' proccess on the system start up
sudo update-rc.d unicorn defaults
@eveevans
eveevans / gist:4075479
Created November 14, 2012 23:03
Ruby Debugger with RVM and Ruby 1.9.3
rvmsudo gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-head/
@eveevans
eveevans / gist:3430445
Created August 22, 2012 23:07
Reveal Password
javascript:(function(){var s,F,j,f,i; s = ""; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == "password") s += f[i].value + "\n"; } } if (s) alert("Passwords in forms on this page:\n\n" + s); else alert("No password form :(.");})();
@eveevans
eveevans / gist:3430390
Created August 22, 2012 22:55
Browser, editable mode
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
@eveevans
eveevans / galería wp
Created August 3, 2012 21:28
extraer todas las imagenes asociadas de un post
<h1><?php the_title() ?></h1>
<?php
$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
if ( $images ) :
?>
<?php foreach($images as $ima): ?>
<div class="gallery-thumb ev-gallery">
<a rel="ev-gallery" class="size-thumbnail" href="<?php echo wp_get_attachment_url($ima->ID); ?>"><?php echo wp_get_attachment_image( $ima->ID, 'thumbnail' ); ?></a>