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
/* | |
Ubiquity Command: download-files [regexp pattern] to [folder] | |
Author: Duane Johnson | |
Email: [email protected] | |
Description: Downloads files matching the regular expression pattern to a folder. | |
2009-08-29: Updated for Ubiquity 0.5.x | |
See: http://github.com/canadaduane/ubiquity-download-files | |
*/ |
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
CmdUtils.CreateCommand({ | |
name: "search-domain-name", | |
icon: "http://instantdomainsearch.com/favicon.ico", | |
author: {name: "Pratham Kumar", email: "[email protected]"}, | |
description: "Checks availabilty of the domain name with com/net/org TLDs.", | |
homepage: "http://pratham.name/", | |
takes: {"example.com": noun_arb_text}, | |
preview: function (html, q) { | |
var params = {name: q.text}; |
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
CmdUtils.CreateCommand({ | |
names: ["eyes like lightning"], | |
arguments: [ {role: 'object', nountype: noun_arb_text, label: 'input'} ], | |
author: {name: "Duane Johnson", email: "[email protected]"}, | |
license: "GPL", | |
description: "Opens a speed-reading window above the currently selected text.", | |
help: "Select some text, and then use the eyes like lightning command to start reading it.", | |
preview: function(pblock, args) { |
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 'json' | |
$log_filename ||= File.expand_path(File.join("..", "ruby.log.json"), File.dirname(__FILE__)) | |
begin | |
if !File.exist?($log_filename) | |
File.open($log_filename, "w") do |f| | |
f.write "[" | |
end | |
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
class FeatureSet | |
include Enumerable | |
def initialize(*features) | |
@features = features | |
end | |
def randomly_choose_one | |
@features[rand(@features.size)] | |
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
/* jQuery plugin textselect | |
* version: 1.0 | |
* tested on jQuery 1.3.2, 1.5 | |
* author: [email protected], [email protected] | |
* | |
* usage: | |
* $(function() { | |
* $(document).bind('textselect', function(e) { | |
* Do stuff with e.text | |
* }); |
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
def app_path(path, params={}) | |
if params.size == 0 | |
uri(path) | |
else | |
query_string = "" | |
params.each_pair do |key, value| | |
query_string += key.to_s + '=' + escape(value.to_s) | |
end | |
uri(path) + '?' + query_string | |
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
$ make | |
gcc -c -std=gnu99 -O2 -fdata-sections -ffunction-sections -Wall -o netrap-controller.o netrap-controller.c | |
netrap-controller.c: In function ‘sockport’: | |
netrap-controller.c:151: warning: unused variable ‘port’ | |
netrap-controller.c: In function ‘new_listen_socket’: | |
netrap-controller.c:410: error: ‘buf’ undeclared (first use in this function) | |
netrap-controller.c:410: error: (Each undeclared identifier is reported only once | |
netrap-controller.c:410: error: for each function it appears in.) | |
netrap-controller.c:414: error: ‘listen_socket’ has no member named ‘protocol’ | |
netrap-controller.c: In function ‘new_http_socket’: |
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
# Here's my method that loops over a collection and yields a block | |
def tardies_for_student(student_id, now=Time.zone.now) | |
submissions_by_student_id[student_id].each do |submission| | |
assignment = @assignments_by_id[submission.assignment_id] | |
yield build_tardy(assignment, submission, now) | |
end | |
end | |
# now I know I can do this... |
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
UBUNTU_IP=172.16.232.100 | |
GUEST_DIR=/media/duane | |
MOUNTPOINT=/tmp/archive | |
if [ ! -d "$MOUNTPOINT" ]; then | |
echo "Mount point $MOUNTPOINT does not exist, creating..." | |
mkdir -p $MOUNTPOINT | |
fi | |
FIRSTDIR=`ls -1 $MOUNTPOINT` |
OlderNewer