This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var theElement = "einstein-sb"; | |
var req = false; | |
getEinsteinInfo(); | |
function loadXMLDoc(url, method, async) { | |
try | |
{ | |
if (window.XMLHttpRequest) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cache < ActiveRecord::Base | |
serialize :value | |
def self.get(key, max_age = 1.hour) | |
item = Cache.first(:conditions => { :key => key }) | |
if block_given? | |
if item.nil? || item.updated_at < max_age.ago | |
begin | |
value = yield | |
Cache.put(key,value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$.doAfter(2500, function() { | |
$('#my-elem').show("bounce", { times: 6 }, 300); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Content-Type: multipart/form-data; boundary=----------------------------f2404c5f8da2 | |
------------------------------f2404c5f8da2 | |
Content-Disposition: form-data; name="name" | |
something | |
------------------------------f2404c5f8da2 | |
Content-Disposition: form-data; name="file"; filename="astring" | |
Content-Type: application/octet-stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main_links.each do |link| | |
dir = link.split('.').first # i get 'name' or 'name-2' to download into | |
begin | |
page = Hpricot(open("#{domain}/#{link}")) | |
links = page.search('a').select do |l| | |
l.attributes['href'] =~ /javascript:OpenLink\((.*)\)/ | |
!($1 =~ /^\'\w+\.\w+\'$/) | |
end.map do |l| | |
l.attributes['href'].to_s =~ /javascript:OpenLink\(\'(.*)\'\)/ | |
decode_url($1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.unescape = function() { | |
var node = document.createElement('div'); | |
node.innerHTML = this; | |
if('undefined' == typeof(node.innerText)) { | |
return node.textContent; // FF | |
} | |
return node.innerText; // IE | |
} |