Skip to content

Instantly share code, notes, and snippets.

View yetanothernguyen's full-sized avatar

Nguyen Vu Nguyen yetanothernguyen

View GitHub Profile
@yetanothernguyen
yetanothernguyen / gist:1246989
Created September 28, 2011 04:29
erly.com image tag
<div class="post card laidout" data-postid="2416174" id="post_2416174" style="top: 0px; left: 261px; width: 250px; height: 192px; "> <div class="photo" style="width: 250px; height: 162px; ">
<img class="needs-center-letterbox lazy-loaded center-letterboxed" data-lazy-src="https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/314433_10150264072250981_567335980_8068159_6857977_n.jpg" src="https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/314433_10150264072250981_567335980_8068159_6857977_n.jpg" alt="" data-height="540" data-width="720" style="height: auto; width: 250px; margin-left: 0px; margin-top: -9px; opacity: 1; ">
<div class="enlarge-overlay overlay fade-in" style="width: 250px; height: 162px; display: none; "></div>
</div>
</div>
@yetanothernguyen
yetanothernguyen / gist:1196492
Created September 6, 2011 03:11
unicorn init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: says-dot-com-production
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the says-dot-com-production unicorns at boot
# Description: Enable says-dot-com-staging at boot time.
### END INIT INFO
@yetanothernguyen
yetanothernguyen / gist:1196486
Created September 6, 2011 03:08
unicorn config
# Sample verbose configuration file for Unicorn (not Rack)
#
# This configuration file documents many features of Unicorn
# that may not be needed for some applications. See
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
# for a much simpler configuration file.
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
//= require underscore
//= require backbone
// TODO: move this out
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
@yetanothernguyen
yetanothernguyen / youtube
Created June 28, 2011 04:29
Youtube wrapper class
require 'youtube_it'
module Says
class Youtube
attr_accessor :video, :vid, :client
def initialize(url=nil, username=nil, password=nil, dev_key=nil)
@url = url
@username = username
@password = password
@dev_key = dev_key
def failed(job)
begin
if job.payload_object.respond_to? :on_permanent_failure
say "Running on_permanent_failure hook"
job.payload_object.on_permanent_failure
end
rescue DeserializationError
# do nothing
end
def failed(job)
begin
if job.payload_object.respond_to? :on_permanent_failure
say "Running on_permanent_failure hook"
job.payload_object.on_permanent_failure
end
rescue DeserializationError
# do nothing
end