Skip to content

Instantly share code, notes, and snippets.

View lamp's full-sized avatar
🇨🇦

@lamp lamp

🇨🇦
  • BC
  • 19:48 (UTC -06:00)
View GitHub Profile
app/models/sidebar_stat.rb:90:in `cache'
app/models/sidebar_stat.rb:24:in `block in sidebar'
app/models/sidebar_stat.rb:19:in `each'
app/models/sidebar_stat.rb:19:in `sidebar'
app/controllers/videos_controller.rb:5:in `index'
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
@lamp
lamp / gist:2218461
Created March 27, 2012 18:02
nice js code to keep
var colour_map = (function(colours){
var map = {},
intervals = 100 / (colours.length - 1),
count = 0,
returnable = [];
$.each(colours, function(i, col){
var next = parseInt(colours[i + 1], 16),
current = parseInt(col, 16),
count_dir = (next > current),
if(_.isUndefined(providers.Def)) providers.Def = {};
providers.Def.Product = function(attrs){
this.init(attrs);
};
providers.Def.Product.prototype = {
init : function(attrs){
Are YOU sitting comfortably? Then prepare for a shock. You may even like to pour yourself a stiff drink. I’m about to defend the Guardian.
First, though, the caveats. When I heard that Scotland Yard was using the Official Secrets Act in an attempt to force Guardian journalists to name the sources of their stories about the phone-hacking investigation, my instinctive initial reaction was: serves them right.
Even those of us who find the Guardian insufferably smug, self-righteous and censorious applauded the journalistic operation which uncovered the extent of wrong-doing by some executives at the News of the World.
The revelation that a private investigator employed by the Screws had hacked into the voicemail of murdered schoolgirl Milly Dowler escalated the affair from a piece of politico/media navel gazing to a full-blown public scandal.
Last night, News International, the paper’s publisher, agreed to pay the Dowler family £2 million compensation, with a further £1 million going to charity.
Settlement: R
$(function(){
var intervals = [];
$("#scroller-inner").children('div').each(function(k, v){
intervals.push(parseInt($(this).attr('id').split('-')[1]));
})
setInterval(function(){
if(typeof(player.isSessionReady) == 'undefined') return;
if(!player.isSessionReady()) return;
@lamp
lamp / gist:1106574
Created July 26, 2011 11:53
for henry
<?
if($_GET['q']){
echo $_GET['q'];
}
?>
<form method="get">
<input type="text" name="q" />

SPA Single page architecture lib design "Spah"

Assumptions:

  • Host API is RESTish
  • All host-client transfer is with JSON and all client-host transfer is with POST and multipart POST.
  • Client-side progressive enhancements are the responsibility of the developer
  • The server-side portion of the library will be ruby-based, and the client-side portion will be jquery-based, but the DTOs used to communicate between two will be thoroughly documented to allow drop-in replacement on either side.
<object width="100%" height="100%" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="videojuicer_seed_<%=presentation.seed_name %>_presentation_<%=presentation.id %>">
<param name="movie" value="http://player.videojuicer.com/bootstrap.swf">
<param name="allowFullScreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="autoplay" value="true">
<param name="FlashVars" value="seed_name=<%=presentation.seed_name%>&amp;presentation_id=<%=presentation.id%>&amp;AUTOPLAY=true">
<param name="name" value="videojuicer_seed_<%=presentation.seed_name %>_presentation_<%=presentation.id %>">
<param name="wmode" value="transparent">
<embed src="http://player.videojuicer.com/bootstrap.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" flashvars="seed_name=<%=presentation.seed_name %>&amp;presentation_id=<%=presentation.id %>&amp;AUTOPLAY=true" width="100%" height="100%" name="videojuicer_seed_<%=presentation.seed_name %>
#henryskneethingy
require "rubygems"
require "net/http"
require "net/https"
require "json"
require "open-uri"
$app_id = "xxxxx"
$app_secret = "xxxxx"
$access_code = "xxxxx"
undefined method `merge' for "development":String
/Users/matthew/.bundle/ruby/1.8/gems/dm-core-0.10.2/lib/dm-core/model.rb:384:in `first_or_create'
/work/videojuicer/vj-core/lib/tasks/vj-sdk.rake:18
/Users/matthew/.bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/matthew/.bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Users/matthew/.bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/matthew/.bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/matthew/.bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/matthew/.bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'