Skip to content

Instantly share code, notes, and snippets.

View jkriss's full-sized avatar

Jesse Kriss jkriss

View GitHub Profile
@jkriss
jkriss / dansinker.json
Last active December 23, 2015 21:09
@dansinker's glorious rant
[
{
"created_at": "Wed Sep 25 02:50:26 +0000 2013",
"text": "This has been a day.",
"id_str": "382698582274371587"
},
{
"created_at": "Wed Sep 25 02:50:21 +0000 2013",
"text": "That's all. \n\nI didn't intend to go down this path. Glad I did.",
"id_str": "382698557741867008"
def Crop.interesting
puts "WHAT'S IN THE CACHE NOW?"
puts Rails.cache.read("interesting_crops").to_yaml
json_crops = Rails.cache.fetch("interesting_crops", :expires_in => 1.day) do
howmany = 12 # max number to find
interesting_crops = Array.new
Crop.randomized.each do |c|
break if interesting_crops.length == howmany
next unless c.interesting?
interesting_crops.push(c)
%script{ :type => 'text/x-handlebars-template', :name => 'PerformanceView' }
%li.calendar
%span.time {{timeOfDay}}
%span.day_of_week {{day}}
%span.day {{shortDate}}
import com.sun.image.codec.jpeg.*;
ByteArrayOutputStream out = null;
BufferedImage img = null;
JPEGImageEncoder encoder = null;
JPEGEncodeParam encpar = null;
void setup() {
size(200,200);
out = new ByteArrayOutputStream();
javascript:void%20%28%28function%28%29%7B%0Aif%20%28%21document.getElementById%28%22Ijquery%22%29%29%20%7B%0Avar%20noeud_js%20%3D%20document.createElement%28%22script%22%29%3B%0Anoeud_js.setAttribute%28%22type%22%2C%20%22text%2Fjavascript%22%29%3B%0Anoeud_js.setAttribute%28%22id%22%2C%20%22Ijquery%22%29%3B%0Anoeud_js.setAttribute%28%22src%22%2C%20%22http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1%2Fjquery.min.js%22%29%3B%0Adocument.getElementsByTagName%28%22head%22%29%5B0%5D.appendChild%28noeud_js%29%3B%0A%7D%0Afunction%20jquery_loaded%28%29%7B%0Avar%20tmp%20%3D%20%22false%22%3B%0Atry%20%7Btmp%20%3D%20%24%28%22body%22%29.text%28%29%3B%7Dcatch%20%28erreur%29%20%7Btmp%20%3D%20%22false%22%3B%7D%0Areturn%20tmp%3B%7D%0Afunction%20verif_loaded%28%29%7B%0Avar%20temp%20%3D%20jquery_loaded%28%29%3B%0Aif%20%28temp%20%21%3D%20%22false%22%29%20%7B%0AclearInterval%28interval%29%3B%0Acode%28%29%3B%0A%7D%0A%7D%0Avar%20interval%20%3D%20window.setInterval%28verif_loaded%2C%20100%29%3B%0Afunction%20code%28%29%0A%7B
<p style="font-family: Helvetica, Arial, sans-serif; font-size: 0.8em; color: #555">
mark kriss <span style="color: #bbb">|</span> 415-367-5672 <span style="color: #bbb">|</span> <a style="color: #777" href="http://kriss.org/who">kriss.org/who</a>
</p>
require 'rubygems'
require 'prawn'
require 'prawn/measurement_extensions'
require 'RMagick'
show_name = ARGV[0]
output_name = ARGV[1]
Prawn::Document.generate("#{output_name}.pdf", :page_size => [11.in, 17.in], :left_margin => 0, :top_margin => 0, :right_margin => 0, :bottom_margin => 0) do
background = File.join(File.dirname(__FILE__),'assets/poster-background.jpg')
class Statter
def initialize
@stat_calcuations = {}
@results = {}
end
def stat_calcuation(name, args, &block)
@stat_calcuations[name] = StatCalculation.new(name, args, block)
end
require 'rubygems'
require 'sinatra'
require 'twilio'
Twilio.connect(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])
RECORDINGS = %w{
http://mp3.com/1
http://mp3.com/2
http://mp3.com/3
@jkriss
jkriss / gist:276717
Created January 14, 2010 00:08
an example env.rb file for cucumber, safariwatir, and machinist
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "cucumber"
require 'safariwatir'
require File.expand_path(File.dirname(__FILE__) + '/../../../config/environment')
require 'machinist'
require File.expand_path(File.dirname(__FILE__) + "/../../../test/blueprints")
ActionMailer::Base.default_url_options[:host] = "localhost"