Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Daniel Huckstep darkhelmet

🏠
Working from home
View GitHub Profile
View chromium-install.sh
#!/usr/bin/env bash
# install some packages
sudo aptitude install -y subversion pkg-config python perl g++ g++-multilib bison flex gperf libnss3-dev libgtk2.0-dev libnspr4-0d libasound2-dev libnspr4-dev msttcorefonts libgconf2-dev libcairo2-dev libdbus-1-dev wdiff
# get and setup the depot tools
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
export PATH=`pwd`/depot_tools:$PATH
mkdir chromium
pushd chromium
View lark_template.rb
# download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"
exit!
View controllers.rb
class WidgetController < ApplicationController
include RespondGlue
def index
@widgets = some_magic
respond_glue(:html) { render(:template => 'widgets/index') }
end
def show
@widget = get_widget
View jquery-timeout-animate.js
(function($){
$.doAfter = function(time,f) {
$('body').animate({ opacity: 1 }, time, f);
};
})(jQuery);
$(document).ready(function(){
$.doAfter(2500,function() {
$('.fadeout').fadeOut('slow');
});
View setup-role.rb
role_on :admin, :except => [:index,:show]
role_on :other_role, :on => [:index,:show]
View jquery-remote-inline.js
$.fn.setupRemoteInline = function() {
return this.each(function() {
$(this).click(function() {
var link = $(this);
link.unbind('click');
link.html('Loading...');
$.ajax({
url:this.href,
type:'GET',
success:function(data) {
View output.txt
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/home/darkhelmet/local/llvm-gcc --enable-languages=c,c++ --program-prefix=llvm- --enable-llvm=/home/darkhelmet/local/llvm
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5636) (LLVM build)
View post-varnish.txt
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking blog.darkhax.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 400 requests
View gtk-mod.rb
require "thread"
module Gtk
PENDING_CALLS_MUTEX = Mutex.new
PENDING_CALLS = []
def self.thread_protect(&proc)
if Thread.current == Thread.main
proc.call
else
View cucumber-eval.rb
Then /^I should be (editing|viewing) "([^\"]*)"$/ do |method,login|
func = (method == 'editing' ? 'edit_' : '') + 'user_path'
URI.parse(current_url).path.should == eval("#{func}(User.find_by_login(login))")
end