Skip to content

Instantly share code, notes, and snippets.

View LucasArruda's full-sized avatar
🎯
Focusing

Lucas Arruda LucasArruda

🎯
Focusing
View GitHub Profile
@joel
joel / redis.rb
Created April 14, 2012 16:11
config/initializers/redis.rb
class MockRedis
attr_accessor :store
def initialize
@store = {}
end
def flushall
@store = {}
end
@unclebob
unclebob / apology.
Created April 27, 2012 12:19
Apology to Women Programmers.
Today I gave a keynote at ACCU in Oxford. In the midst of it I made two (count them) two statements that I should have known better than to make. I was describing the late '70s, and the way we felt about the C language at the time. My slide said something like: "C was for real men." Emily Bache, whom I know and hold in high regard, spoke up and said "What about women?". And I said something like: "We didn't allow women in those days." It was a dumb crack, and should either not have been said, or should have been followed up with a statement to the effect that that was wrong headed.
The second mistake I made was while describing Cobol. I mentioned Adm. Grace Hopper. I said something like "May she rest in peace." I don't know that any of the words were actually demeaning, but the tone was not as respectful as it should have been to an Admiral in the United State Navy, and one who was so instrumental in our industry; despite what I feel about Cobol.
I am a 59 year old programmer who was brought up
@aderowbotham
aderowbotham / django_ami.md
Created June 7, 2012 14:19
Django stack setup on EC2 AMI

Django Stack

Overview

This is a set of instructions to setup a Django Nginx Gunicorn MySQL/Postgres stack on a single Amazon EC2 instance.

Server - AWS

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
@lexmag
lexmag / article.rb_product.rb
Created July 28, 2012 15:12
Two-way polymorphic models / Polymorphic HABTM association
class Article < ActiveRecord::Base # Product class is similar
belongs_to :user
has_many :media, as: :ownable
with_options through: :media, source: :representable do |assn|
assn.has_many :videos, source_type: 'Video'
assn.has_many :images, source_type: 'Image'
end
end
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@marcelojunior
marcelojunior / gist:3708804
Created September 12, 2012 18:19
Inflections PT-BR Rails
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@1st
1st / tests_for_toptal_on_codility.py
Last active May 19, 2022 19:58
My answers for tests on http://codility.com that I passed for company http://toptal.com I use Python language to solve problems.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Test that I passed on codility.com for TopTal company
#
# Task #1
def binary_gap(N):
@benschwarz
benschwarz / csrf-token.js
Created April 7, 2013 23:11
Set the CSRF token for Rails when doing Ajax requests
define( ['jquery'], function ( $ ) {
var token = $( 'meta[name="csrf-token"]' ).attr( 'content' );
$.ajaxSetup( {
beforeSend: function ( xhr ) {
xhr.setRequestHeader( 'X-CSRF-Token', token );
}
});
return token;