Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓

Robert Sköld slaskis

🤓
View GitHub Profile
View gist:58718
def day_at_ted(local_datetime, local_offset)
pac_time = local_datetime - offset.hours - 8.hours
return pac_time.date
end
def search
search_since = day_at_ted(local_datetime, local_offset) + " 08:00:00"
search_before = day_at_ted(local_datetime, local_offset) + 1.day + " 07:59:00"
end
View gist:58719
// Get the selected date and apply the current local time
var currentTime : Date = day.date;
var now : Date = new Date();
currentTime.setHours( now.hours, now.minutes , now.seconds );
var yesterday : Date = new Date( currentTime.time );
yesterday.date -= 1;
query += " published_after:\"" + df.format( DateUtil.toPST( yesterday ) ) + " 16:00\"";
View models.rb
require "vendor/dm-core"
require "dm-is-tree"
require "dm-timestamps"
class Node
include DataMapper::Resource
has n, :medias, :through => :node_medias
property :id, Serial
View gist:72894
/Users/slaskis/.gem/ruby/1.8/gems/dm-core-0.9.10/lib/dm-core/associations/relationship_chain.rb:49:in `initialize': undefined method `name' for nil:NilClass (NoMethodError)
from /Users/slaskis/.gem/ruby/1.8/gems/dm-core-0.9.10/lib/dm-core/associations/one_to_many.rb:56:in `new'
from /Users/slaskis/.gem/ruby/1.8/gems/dm-core-0.9.10/lib/dm-core/associations/one_to_many.rb:56:in `setup'
from /Users/slaskis/.gem/ruby/1.8/gems/dm-core-0.9.10/lib/dm-core/associations.rb:122:in `has'
from ./models.rb:10
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from pulplabs.rb:6
from /Users/slaskis/.gem/ruby/1.8/gems/sinatra-0.9.0.4/lib/sinatra/base.rb:644:in `configure'
from /Users/slaskis/.gem/ruby/1.8/gems/sinatra-0.9.0.4/lib/sinatra/base.rb:831:in `configure'
View gist:91893
var flashvars = {
};
var params = {
menu: "false",
allowFullScreen:"true"
};
var attributes = {
id: "pulplabs",
name: "pulplabs"
View plugout
#!/usr/bin/env ruby -w
#=> aaron@rubyamf.org
require 'rubygems'
require 'fileutils'
require 'optparse'
default_browser = 'firefox'
OPTIONS = {}
OPTIONS[:default_plugin] = 'flash'
OPTIONS[:default_user] = `whoami`.chop!
View threads.i
# 1 "vm/threads.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "vm/threads.c"
# 17 "vm/threads.c"
# 1 "vm/vm.h" 1
# 19 "vm/vm.h"
# 1 "/usr/include/setjmp.h" 1 3 4
# 26 "/usr/include/setjmp.h" 3 4
# 1 "/usr/include/machine/setjmp.h" 1 3 4
View Regex.hx
class Regex {
var exp : EReg;
var str : String;
public function new( r : EReg ) {
exp = r;
}
public function match( s : String ) {
View gist:138108
build {
exec /bin/sh -c "cd ${worksrcpath} && make universal prefix=${prefix}"
}
View gist:138137
install:
-mkdir ${DESTDIR}/lib
cp bin/${LIBNEKO_NAME} ${DESTDIR}/lib
-mkdir ${DESTDIR}/bin
cp bin/neko bin/nekoc bin/nekotools bin/nekoml bin/nekoml.std ${DESTDIR}/bin
-mkdir ${DESTDIR}/lib/neko
cp bin/*.ndll ${DESTDIR}/lib/neko
-mkdir ${DESTDIR}/include
cp vm/neko*.h ${DESTDIR}/include