This file contains hidden or 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
| var friends = document.getElementById("friends").getElementsByTagName("a") | |
| var clickEvent = document.createEvent("MouseEvents"); | |
| clickEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
| for(var i = 0; i < friends.length; i++) {friends[i].dispatchEvent(clickEvent);} |
This file contains hidden or 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
| This is an example gist! |
This file contains hidden or 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
| require 'rubygems' | |
| require 'RMagick' | |
| require 'narray' | |
| class WaveformRenderer | |
| # image size in pixel | |
| DEFAULT_WIDTH = 1024 | |
| DEFAULT_HEIGHT = 512 | |
| # default graph color | |
| DEFAULT_COLOR = "#666" |
This file contains hidden or 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
| # | |
| # $TM_FILENAME | |
| # | |
| # Created by `id -P | awk -F ":" '{ print $8 }'` on `date "+%d/%m/%Y"`. | |
| # | |
| # Copyright (c) 2010 ${2:$TM_ORGANIZATION_NAME} | |
| # All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions |
This file contains hidden or 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
| import csv | |
| import json | |
| f = open( 'photos.csv', 'r' ) | |
| reader = csv.DictReader( f, fieldnames = ( "thumbpath", "imgpath", "imgsrc", "width", "height", "thumbsrc", "thumbwidth", "thumbheight" ) ) | |
| out = json.dumps( [ row for row in reader ] ) | |
| print out |
This file contains hidden or 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 Contact < Tableless | |
| column :email, :string | |
| column :message, :text | |
| validates_presence_of :email, :message | |
| end |
This file contains hidden or 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
| require 'spec_helper' | |
| describe AdminController do | |
| before { login } | |
| it "should be accessible only by admins!" | |
| end |
This file contains hidden or 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
| # A simple expiring cache suitable for use with the PStore store. | |
| # | |
| # Usage: | |
| # SimpleCache.fetch('my_data', 15.minutes) do | |
| # MyModel.expensive_query | |
| # end | |
| # | |
| require 'pstore' |
This file contains hidden or 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
| # create foo branch | |
| git checkout -b foo | |
| # do some stuff on foo branch | |
| # add changes and commit | |
| git add . | |
| git commit -m "add foo feature" | |
| # merge foo branch into master branch |
OlderNewer