Skip to content

Instantly share code, notes, and snippets.

View mnutt's full-sized avatar

Michael Nutt mnutt

View GitHub Profile
hi there
def search(*args)
params = {:id => content_ids}
if Hash === args.last
if args.last[:conditions]
args.last[:conditions].merge!(params)
else
args.last[:conditions] = params
end
else
args << {:conditions => params}
def hello
puts "this is a test"
end
#!/usr/bin/env ruby
# Kata #4: Football Data
def smallest_spread(file)
weather_data = File.open(file).readlines
temp_spread = weather_data.map {|line|
next unless line.match(/\s([A-Za-z_]+).*?(\d+)\s\s-\s\s(\d+)/)
day, max, min = $1, $2.to_i, $3.to_i
== Bridge Features ==
System
* shutdown() - shutdown limewire
-- org.limewire.core.api.Application::stopCore()
* restart() - restart limewire
-- org.limewire.core.api.Application::startCore() ?
* setOption() - change a configuration option
-- #TODO
* getOption() - retrieve a configuration option
== Bridge API ==
=== Requests ===
A bridge command is written in YAML, in the following format:
Request:
---
handler: library
action: show
diff --git a/apps/tracker/modules/torrent/actions/actions.class.php b/apps/tracker/modules/torrent/actions/actions.class.php
index 2997f23..fbd83ae 100644
--- a/apps/tracker/modules/torrent/actions/actions.class.php
+++ b/apps/tracker/modules/torrent/actions/actions.class.php
@@ -48,8 +48,6 @@ class torrentActions extends sfActions
if(function_exists("apache_setenv")) // could be running under fastcgi or in non-apache env
apache_setenv('no-gzip', 1);
ini_set('zlib.output_compression', 0);
- ini_set('implicit_flush', 1);
- header('Content-type: multipart/x-mixed-replace;boundary="rn9012"');
# .git/hooks/pre-commit:
#!/usr/bin/env sh
rake static:generate
git add static
# Rake task:
require 'rake'
ROOT = File.join(File.dirname(__FILE__))
#!/usr/bin/env ruby
port_list = `port installed`
port_list.each_line do |port_line|
port_line =~ / ([^\s]+) @([^\+\s]+)(\+?[^\s]*)/
name, version, variants = $1, $2, $3
next if name.nil?
variants = variants.split('+') rescue []
puts "sudo port install #{name} #{variants.map{|v| " +"+v unless v == '' }.join}"
end
$.fn.updateList = function(playlist) {
var items = itemsFromPlaylist(playlist);
var headers = commonHeaders(items);
for(var i in playlist.files) {
var innerHtml = "";
for(var j in headers) {
innerHtml += "<td class='"+headers[j]+"'>" + (state.library[playlist.files[i]][headers[j]] || '') + "</td>";
}
var newRow = $('<tr id="'+playlist.name+'_'+playlist.files[i]+'"><td><input type="checkbox" value="' + playlist.files[i] + '" /></td>' + innerHtml + "&nbsp;</tr>").data('idx', playlist.files[i]);