Skip to content

Instantly share code, notes, and snippets.

View atombender's full-sized avatar

Alexander Staubo atombender

View GitHub Profile
@atombender
atombender / git-switch-github-owner.rb
Created June 4, 2012 11:30
Git script to change a repo's push/pull URLs to point to another Github owner
#!/usr/bin/env ruby
def run(s)
puts "[#{s}]"
result = `#{s}`
unless $?.exited? and $?.exitstatus == 0
abort "Failed to run: #{s}"
end
result
end
# Først må du gjøre:
#
# gem install httpclient
#
require 'httpclient'
require 'json'
class KryssordWrapper
@atombender
atombender / arraytest.go
Created July 5, 2012 14:17
Array traversal benchmark
package main
import (
"runtime"
"fmt"
"time"
)
const (
N = 300000000
<TranslationUnit ptr="0x7fa46282a2d0">
<Typedef ptr="0x7fa46282a790" name="__int128_t" typeptr="0x0">
<BuiltinType ptr="0x7fa46282a520" canonical="0x7fa46282a520"/>
</Typedef>
<Typedef ptr="0x7fa46282a7f0" name="__uint128_t" typeptr="0x0">
<BuiltinType ptr="0x7fa46282a540" canonical="0x7fa46282a540"/>
</Typedef>
<Record ptr="0x7fa46282a840" name="__va_list_tag" typeptr="0x7fa46282a8c0">
<Field ptr="0x7fa46282a8f0" name="gp_offset">
<BuiltinType ptr="0x7fa46282a460" canonical="0x7fa46282a460"/>
/Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/analyze/method_validation.rb:73:in `on_method': undefined method `name' for nil:NilClass (NoMethodError)
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:190:in `execute_callback'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:153:in `block in iterate'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:146:in `each'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:146:in `iterate'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:156:in `block (2 levels) in iterate'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:155:in `each'
from /Users/alex/.rvm/gems/ruby-1.9.3-p194/gems/ruby-lint-0.0.1a1/lib/ruby-lint/iterator.rb:155:in `block in iterate'
from /Users/alex/.rvm/gems/ruby-
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai 2</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
- (void) updateConstraints {
NSMutableDictionary* views = [NSMutableDictionary new];
[views setObject: textView forKey: @"textView"];
[views setObject: resultTableView forKey: @"resultTableView"];
[self removeConstraints: [self constraints]];
[self addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:
@"H:|-15-[textView(>=100)]-15-|"
options: 0
metrics: nil
# Unicode
set convert-meta off
set input-meta on
set output-meta on
# Miscellaneous options
set bell-style audible
set horizontal-scroll-mode off
set mark-directories on
set match-hidden-files on
require 'uglifier'
require 'yaml'
desc 'Create bundle file'
task :bundle do
main_file = File.expand_path('../index.js', __FILE__)
YAML.load(File.open('bundles.yml')).each do |name, opts|
flags = []
if (excludes = [opts['excludes']].flatten)
excludes.each do |exclude|
[{"cull": true, "weight": 0, "dimension": "kind", "value": "ad"}, {"nullExactMatch": true, "dimension": "photos_count", "exactMatch": true, "id": "Yes"}, {"cull": true, "dimension": "category", "weight": 0, "id": "Real Estate"}, {"operator": "or", "criteria": [{"weight": 0.01, "exactMatch": true, "longitude": -73.759, "latitude": 42.747, "nullExactMatch": true, "dimension": "location"}, {"operator": "and", "criteria": [{"dimension": "city", "value": "Latham"}, {"dimension": "state", "value": "NY"}]}]}]