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
# l33t regular expression for matching URLs | |
# thanks @ Alex Payne of Twitter for providing this | |
# http://groups.google.com/group/twitter-development-talk/browse_thread/thread/369d81c2010f16a8#msg_eb0409891c5e18e3 | |
%r{(<\w+.*?>|[^=!:'"/]|^)((?:https?://)|(?:www\.))([-\w]+(?:\.[-\w]+)*(?::\d+)?(?:/(?:(?:[~\w\+%-]|(?:[,.;@:][^\s$]))+)?)*(?:\?[\w\+%&=.;:-]+)?(?:\#[\w\-\.]*)?)([[:punct:]]|\s|<|$)}x |
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
task :spec do | |
require 'rubygems' | |
Gem::manage_gems | |
require 'rake/gempackagetask' | |
gemspec = ENV['gemspec'] || '' | |
@spec = eval(File.read(gemspec + '.gemspec')) | |
Rake::GemPackageTask.new(@spec) do |pkg| | |
pkg.need_tar = true |
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/php -q | |
<?php | |
// modified from http://3v1n0.tuxfamily.org/scripts/detextile/HTML-to-Textile.php | |
class html2textile { | |
function detextile($text) { | |
$text = preg_replace("/(<\/?)(\w+)([^>]*>)/e", "'\\1'.strtolower('\\2').'\\3'", $text); | |
$text = preg_replace("/<br[ \/]*>\s*/","\n",$text); | |
$text = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $text); | |
$text = stripslashes($text); | |
$oktags = array('p','ol','ul','li','i','b','em','strong','span','a','h[1-6]', |
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
require 'find' | |
desc 'Compile CoffeeScript files to JavaScript' | |
task :coffee do | |
files_to_compile = [] | |
# Find the | |
Dir.chdir File.join(Rails.root.to_s, 'public', 'javascripts') do | |
Find.find(Dir.pwd) do |path| | |
if FileTest.directory? path |
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() { | |
$('ul.icons li').hover( | |
function() { | |
$('.icon-name', this) | |
.css({opacity: 0}) | |
.animate({opacity: 100}, 1000) | |
}, | |
function() { | |
$('.icon-name', this) | |
.animate({opacity: 0}, 500) |
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
jido = Jido.load 'fr' | |
jido.conjugate 'être' |
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 fs = require('fs'); | |
var http = require('http'); |
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
--Got code from: http://www.haskell.org/haskellwiki/Why_Haskell_matters | |
qsort [] = [] | |
qsort (x:xs) = qsort less ++ [x] ++ qsort more | |
where less = filter (<x) xs | |
more = filter (>=x) xs |
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
zip = (arr1, arr2) -> | |
basic_zip = (el1, el2) -> [el1, el2] | |
zip_with basic_zip, arr1, arr2 | |
# I wrote two implementations of `zipWith`: one is iterative, and one is recursive. Feel free to do some benchmarks if you feel like it :) | |
# zip_with, iterative style | |
zip_with = (func, arr1, arr2) -> | |
min = Math.min arr1.length, arr2.length | |
ret = [] |
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
(fn [thefn] | |
(fn [& args] | |
(apply thefn (reverse args)))) |
OlderNewer