[ Launch: d3 box plot ] 83239bdc4d09ad7fc920 by Aeon
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
require 'api/pools.rb' | |
module Mtool | |
extend Blather::DSL | |
#Blather.logger.level = Logger::DEBUG | |
Blather.logger.level = Logger::INFO | |
@@faye = nil |
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
#!/usr/bin/env ruby | |
require 'resque' | |
Resque.redis.namespace = "resque:#{ENV['APP_NAME']}" | |
while Resque::Failure.count > 0 do |i| | |
job = Resque::Failure.all(0,1) | |
unless !job || job['retried_at'].nil? | |
Resque::Failure.remove(0) | |
else | |
break |
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 page = new WebPage(), | |
address, selector, filename; | |
var system = require('system'); | |
page.onConsoleMessage = function(msg) { | |
system.stderr.writeLine('console: ' + msg); | |
}; | |
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs | |
capture = function(targetFile, clips) { |
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
/* | |
* gulp and site config based on | |
* http://justinjohnson.org/javascript/getting-started-with-gulp-and-browserify/ | |
* https://gist.github.com/Sigmus/9253068 | |
* | |
*/ | |
try { | |
var gulp = require('gulp'), |
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
require 'sinatra' | |
logfile = 'log.json' | |
get '/' do | |
send_file logfile, :type => :text | |
end | |
post '/' do | |
File.open(logfile, 'a') do |filehandle| |
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
function fitStringToSize(str,len) { | |
var result = str; | |
var span = document.createElement("span"); | |
span.style.visibility = 'hidden'; | |
span.style.padding = '0px'; | |
document.body.appendChild(span); | |
// on first run, check if string fits into the length already. | |
span.innerHTML = result; | |
if(span.offsetWidth > len) { |
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
# forums_controller.rb | |
# in show: | |
@topic_pages, @topics = paginate(:topics, :per_page => 23, :conditions => ['forum_id = ?', @forum.id], :order => 'sticky desc, replied_at desc', :select => 'topics.*, IF(unread_user_topics.user_id IS NOT NULL,1,0) AS unread, users.display_name AS last_reply_author', :joins => "LEFT JOIN unread_user_topics ON topics.id = unread_user_topics.topic_id AND unread_user_topics.user_id = #{current_user.id} LEFT JOIN users ON topics.replied_by = users.id") | |
# application_helper.rb | |
# used to know if a topic has changed since we read it last | |
def recent_topic_activity(topic) | |
return false if not logged_in? |
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 Segment < ActiveRecord::Base | |
has_many :street_segments | |
has_many :streets, :through => :street_segments, :source => :street | |
after_save :ensure_primary | |
def ensure_primary | |
if self.streets.size > 0 && self.primary_street.nil? | |
# set the primary street attribute in association (in reality more criteria than just being 'first', but whatever) | |
primary_street = self.street_segments.first |
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
package loganalysis; | |
import java.util.Map; | |
import java.util.Properties; | |
import cascading.cascade.Cascade; | |
import cascading.cascade.CascadeConnector; | |
import cascading.cascade.Cascades; | |
import cascading.flow.Flow; | |
import cascading.flow.FlowConnector; |
OlderNewer