Skip to content

Instantly share code, notes, and snippets.

View darkhelmet's full-sized avatar
🏠
Working from home

Daniel Huckstep darkhelmet

🏠
Working from home
View GitHub Profile
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
require "thread"
module Gtk
PENDING_CALLS_MUTEX = Mutex.new
PENDING_CALLS = []
def self.thread_protect(&proc)
if Thread.current == Thread.main
proc.call
else
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
<?php
/*
Plugin Name: Tweet with surl
Plugin URI: http://s.darkhax.com
Description: Use surl with Twitter Tools
Version: 1.0
Author: Daniel Huckstep
Author URI: http://www.darkhax.com
*/
function get_content($url)
(function($){
$.doAfter = function(time,f) {
$('body').animate({ opacity: 1 }, time, f);
};
})(jQuery);
$(document).ready(function(){
$.doAfter(2500,function() {
$('.fadeout').fadeOut('slow');
});
role_on :admin, :except => [:index,:show]
role_on :other_role, :on => [:index,:show]
feed.entries.each do |e|
"Looking at the entry #{e.title.gsub("n",' ')}".printn
link = (Nokogiri(e.summary)/"img").to_html
next if link.empty?
link = link[/"(.*)"/].gsub(/["]/,'')
filename = link.split('/').last
disk_file = File.expand_path(File.join(ROOT,filename))
unless File.exists?(disk_file)
"Downloading new image #{filename}...".print
Net.download_and_save(link,disk_file)
public static string ToHumanFromPascal(this string s)
{
if (2 > s.Length)
{
return s;
}
var sb = new StringBuilder();
var ca = s.ToCharArray();
sb.Append(ca[0]);
var theElement = "einstein-sb";
var req = false;
getEinsteinInfo();
function loadXMLDoc(url, method, async) {
try
{
if (window.XMLHttpRequest)
{
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
# this fails matching /2009/04/30/borland-c++-builder-5-how-i-hate-thee
get %r|^/\d{4}/\d{2}/\d{2}/[\w\d\-+]+$| do |match|
p match
end