Skip to content

Instantly share code, notes, and snippets.

vagrant@lucid32:~/style$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
Initialized empty Git repository in /home/vagrant/.rvm/src/rvm/.git/
remote: Counting objects: 4939, done.
remote: Compressing objects: 100% (2305/2305), done.
Receiving objects: 100% (4939/4939), 1.61 MiB | 648 KiB/s, done.
remote: Total 4939 (delta 3201), reused 3560 (delta 1951)
Resolving deltas: 100% (3201/3201), done.
RVM: Shell scripts enabling management of multiple ruby environments.
RTFM: https://rvm.beginrescueend.com/
class Generic
class << self
def pattern
/^https?:\/\/.*/i
end
def valid_url? (url)
url.match(pattern)
end
end
class Generic
RE = /^http:\/\//
class << self
def valid_url?(url)
url.match(RE)
end
end
end
<div class="player" style="background-image: url(http://media.giantbomb.com/uploads/6/68564/1821880-screen_shot_2011_06_24_at_9.56.43_am.jpg);" data-video="{&quot;video_url&quot;: &quot;quot;/tf2-meet-the-medic/17-4438/&quot;, &quot;deck&quot;: &quot;Applebee&#39;s promptly rejected the Medic&#39;s idea of serving Heavy-back ribs.&quot;, &quot;publish_date_ts&quot;: 1308936240.0, &quot;subscriber_only&quot;: false, &quot;user_profile_id&quot;: 68564, &quot;object_id&quot;: null, &quot;video_type_id&quot;: 7, &quot;id&quot;: 4438, &quot;staff&quot;: false, &quot;date_added&quot;: &quot;2011-06-24 10:01:35&quot;, &quot;publish&quot;: true, &quot;age_gate&quot;: false, &quot;poster_url&quot;: &quot;http://media.giantbomb.com/uploads/6/68564/1821880-screen_shot_2011_06_24_at_9.56.43_am.jpg&quot;, &quot;publish_date&quot;: &quot;2011-06-24 10:24:00&quot;, &quot;user_name&quot;: &quot;GlenTennis&quot;, &quot;video_comment_count&quot;: 81, &quot;topic_id&quot;: 503699, &quot;image_id&quot;: 1821880, &quot;encoded&qu
@leedo
leedo / server.coffee
Created June 30, 2011 22:27
GridFS file server
mongo = require "mongodb"
express = require "express"
app = express.createServer()
server = new mongo.Server "127.0.0.1", 27017, {auto_reconnect: true}
db = new mongo.Db "ars_api_development", server
send_image = (req, res, db) ->
image_id = req.params[0]
store = new mongo.GridStore db, image_id, "r"
LICENSES = [
"All Rights Reserved",
"Attribution-NonCommercial-ShareAlike License (http://creativecommons.org/licenses/by-nc-sa/2.0/)",
"Attribution-NonCommercial License (http://creativecommons.org/licenses/by-nc/2.0/)",
"Attribution-NonCommercial-NoDerivs License (http://creativecommons.org/licenses/by-nc-nd/2.0/)",
"Attribution License (http://creativecommons.org/licenses/by/2.0/)",
"Attribution-ShareAlike License (http://creativecommons.org/licenses/by-sa/2.0/)",
"Attribution-NoDerivs License (http://creativecommons.org/licenses/by-nd/2.0/)",
"No known copyright restrictions (http://www.flickr.com/commons/usage/)",
"United States Government Work (http://www.usa.gov/copyright.shtml)",
No limit detected for the number of clients
signal_pipe: FD=3 allocated (non-blocking mode)
signal_pipe: FD=4 allocated (non-blocking mode)
stunnel 4.41 on x86_64-unknown-linux-gnu platform
Compiled/running with OpenSSL 1.0.0d 8 Feb 2011
Threading:PTHREAD SSL:ENGINE Auth:none Sockets:POLL,IPv6
stunnel 4.41 on x86_64-unknown-linux-gnu platform
Compiled/running with OpenSSL 1.0.0d 8 Feb 2011
Threading:PTHREAD SSL:ENGINE Auth:none Sockets:POLL,IPv6

#Installing Alice's dependencies from the CPAN

Alice has a number of dependencies, all of which can be installed from the CPAN1. The simplest way to get these installed is with the cpanm tool.

Install cpanm by running

curl -L http://xrl.us/cpanm | perl - --sudo App::cpanminus

Check out alice's git repository

lee@hq:~$ perl sphinx-stats.pl
07-03-2011 | 1382 | 1376
07-04-2011 | 1547 | 1540
07-05-2011 | 3309 | 3300
07-06-2011 | 4073 | 4072
07-07-2011 | 4067 | 4068
07-08-2011 | 4210 | 4203
07-09-2011 | 1749 | 1744
07-10-2011 | 1365 | 1363
07-11-2011 | 620 | 3679
use AnyEvent::AIO;
use IO::AIO;
sub {
my $env = shift;
return sub {
my $respond = shift;
aio_open __FILE__, IO::AIO::O_RDONLY, 0, sub {
my $fh = shift;
warn $fh;