This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery Colourizer | |
// Kent Fenwick 2009 | |
// Use it when you want to add a splash of random colour to your page | |
// Create the colour array | |
var color_array = ["#ce521d","#ca4b89","#006b89","#3e2d7e","#61902c", "#faa31a", "#6e002a", "#4981b3", | |
"#980069", "#2dacbf", "#ee1d25", "#9cb46f", "#9a869e", "#ee008c", "#00a895", | |
"#7b181a", "#ffd63c", "#b46638", "#bcd634", "#f4ea00", "#32b6c0", "#e8ac1c", | |
"#ea2d50", "#3c7022", "#0085cc", "#97C83B"]; | |
// Pick a random colour of the array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here is a little recursive method that pulls in all Twitter friends using recursion | |
require 'rubygems' | |
require 'twitter' | |
def get_twitter_friends_with_cursor(cursor, list, client) | |
# Base case | |
if cursor == 0 | |
return list | |
else | |
hashie = client.friends(:cursor => cursor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
main() | |
{ | |
printf("Change the World"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
connection = MongoClient('173.255.248.42', 27017) | |
db = connection.eventish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script>__FILE__="(none)";page_load_globals.times.code_load_completed = new Date().getTime();host.profiler.stopSummary("~ 0 loading framework js");</script> | |
<!-- DEBUG-TAG: app --> | |
<script>__FILE__="(none)";host.profiler.startSummary("~ 1 creating server globals"); | |
server_globals=(function() {return Deserializer.create().thaw({"S":"C","C":"Map","D":[["current_version",{"S":"C","C":"VersionInfo","D":{"build_time_ms":1360630883000,"build_date_str":"Tue Feb 12 01:01:23 2013 +0000","commit_id":"712592c0708daab876ef4b893da1dd7b5622f983","commit_date_str":"Mon Feb 11 22:07:28 2013 +0000","release_revision":"20130212_010123_712592c0708daab876ef4b893da1dd7b5622f983","session_version":58}}],["session_id",4047635787510],["request_dispatch_time",1360706683095],["enabled_features",{"S":"C","C":"Array","D":["enable_only_propagate_unknown_loading_values_to_loading_boundaries","enable_memcache","enable_search_indexing","enable_action_coalescing","enable_list_caching","enable_fail_on_reentrant_handlers","enable_mobile_task_r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe style="height:360px; width:180px; border:0" src="https://www.tilt.com/tilts/phi-delts-fall-festival-long-sleeve-tshirt/iframe_widget"></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe style="height:360px; width:180px; border:0" src="your_tilt_link_goes_here/iframe_widget"></iframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to your ~/.bash_profile to see which local git branch you are on. | |
function parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[1;34m\]" | |
GREEN="\[\033[0;32m\]" | |
NO_COLOUR="\[\033[0m\]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = File.open("") | |
content = f.read | |
r = Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/) | |
emails = content.scan(r).uniq | |
puts emails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Friend < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :contact, :class_name => "User", :foreign_key => "contact_id" | |
# user befriends contact | |
def self.befriend(user,contact) | |
relationship = find_by_user_id_and_contact_id(user.id,friend.id) | |
if relationship.nil? | |
transaction do |
NewerOlder