Skip to content

Instantly share code, notes, and snippets.

Build that!

David Gil dgilperez

Build that!
Block or report user

Report or block dgilperez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dgilperez / codewall.badges.js
Last active Aug 26, 2015 — forked from marcinbunsch/codewall.badges.js
Coderwall - display missing badges
View codewall.badges.js
// How to use this:
// 1. Go to the desired profile page on coderwall, like
// 2. Paste this gist in the JS console
// You can also probably use this in greasemonkey and dot.js
// Also, it was tested in Chrome, Firefox and Safari, it probably will
// not work in IE, but I just don't care about it ;)
// UPDATE: Coderwall made changes to the site and I cannot retrieve the achievements, so they are hardcoded, taken from a cached version of the achievements page
View gist:8847922
require 'delegate'
class Base
def foo
def bar
View Bitmask.js
// Slick little method to create a bitmask from an array of boolean values. (for Javascript)
function bitMask(a, b) {
var m = 0, i;
if (b !== undefined) { a = Array.prototype.slice.apply(arguments); }
for (i = 0; i < a.length; i += 1) {
if (a[i] !== false) { m += Math.pow(2, i) };
return m;
View abilities.rb
module Abilities
def self.ability_for(user)
if user.admin?
else user
View gist:cfa4a58e990930aaa921
# Parses YouTube URLs directly or from iframe code. Handles:
# * Address bar on YouTube url (ex:
# * Direct url (ex:
# * Full iframe embed code (ex: <iframe src="">)
# * Old <object> tag embed code (ex: <object><param name="movie" value="">...)
$5 #=> the video ID
# test it on Rubular:
View gist:b0f9b3dfe8af0b37b37b
namespace :spec do
# largely lifted from
task :stats_setup do
require 'code_statistics'
class CodeStatistics
alias calculate_statistics_orig calculate_statistics
def calculate_statistics
@pairs.inject({}) do |stats, pair|
if 3 == pair.size
View emoji_image_replace.js
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
* Much of this code was gleaned from staring at the minified GitHub JS.
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
dgilperez / gist:cd04989dd9d54f13a89e
Last active Aug 29, 2015
Sacando un trabajo a medias a una rama
View gist:cd04989dd9d54f13a89e

Sacando código a otra rama

"Ocultas" los cambios en la pila de cambios local

git stash

Creas una rama local (no en github)

View _flash_messages.html.erb
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
<% end %>
You can’t perform that action at this time.