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
# A small DSL for helping parsing documents using Nokogiri::XML::Reader. The | |
# XML Reader is a good way to move a cursor through a (large) XML document fast, | |
# but is not as cumbersome as writing a full SAX document handler. Read about | |
# it here: http://nokogiri.org/Nokogiri/XML/Reader.html | |
# | |
# Just pass the reader in this parser and specificy the nodes that you are interested | |
# in in a block. You can just parse every node or only look inside certain nodes. | |
# | |
# A small example: | |
# |
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
#!/bin/bash | |
function remove_dir () { | |
rm -rf "$1_" | |
if [ -d "$1" ] | |
then | |
mv "$1" "$1_" | |
fi | |
} |
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
attachments: parent_id, asset_id | |
domain_names: organisation_id | |
event_memberships: user_id, event_id | |
events: editor_id | |
group_actions: user_id, group_id | |
groups: user_id | |
icons: parent_id | |
invitations: sender_id | |
legacy_actions: item_upon_id | |
news_items: author_id |
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
import sublime, sublime_plugin, os | |
class TailCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
from datetime import datetime | |
filtertext = "FLO" | |
# open sublime console | |
self.view.window().run_command("show_panel", { "panel": "console", "toggle": "true" }) |
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
Factory.define :application do |factory| | |
factory.attachment :sample, "public/samples/sample.doc", "application/msword" | |
end |
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 type="text/javascript"> | |
var queueBytesLoaded = 0; | |
var queueBytesTotal = 0; | |
var myQueue = null; | |
var queueChangeHandler = function(queue){ | |
// alert('Uploading Started'); | |
myQueue = queue; | |
// console.log("COLLECTION CHANGE!"); | |
var list = document.getElementById('file_todo_list'); |
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
// This is my handler in the javascript | |
var uploadCompleteHandler = function(upload_options,event){ | |
$.ajax({ | |
url: '<%= notify_rails_of_successful_upload_path(:format => :js)%>', | |
global: false, | |
type: 'POST', | |
data: ({ | |
'authenticity_token' : '<%= form_authenticity_token %>', | |
'upload' : { | |
'file_file_name' : upload_options.FileName, |
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
# a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes | |
# NOTE: requires the faker or ffaker gem | |
# sudo gem install faker - http://faker.rubyforge.org | |
# OR | |
# sudo gem install ffaker - http://github.com/EmmanuelOga/ffaker | |
require 'faker' | |
class Fakeout |
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
var minnesota = [{name:"job 1", values:[182904,196530,203944,192492,77393,81243]}]; | |
$(document).ready(function(){ | |
$("button").click(function(){ | |
minnesota = [{name:"changed job", values:[342,34234,2342,543]}]; | |
draw(); | |
}); | |
}); |
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
# Module containing a collect_kv method to allow | |
# a new hash to be generated my collect instead | |
# of returning an array of modified keys or values | |
module CollectKeyValue | |
# Takes a block that returns a [key, value] pair | |
# and builds a new hash based on those pairs | |
def collect_kv | |
result = {} | |
each do |k,v| |
NewerOlder