Skip to content

Instantly share code, notes, and snippets.

We couldn’t find that file to show.
derby = require 'derby'
{get, view, ready} = derby.createApp module
derby.use(require '../../ui')
FeedParser = require('feedparser')
parser = new FeedParser()
## ROUTES ##
@sadjow
sadjow / gist:4162756
Created November 28, 2012 17:36
Create a server with http-proxy node.js - Multiple domains.
var http = require('http'),
httpProxy = require('http-proxy');
httpProxy.createServer(function (req, res, proxy) {
if(req.headers.host == 'sadjow.com') {
proxy.proxyRequest(req, res, {
host: 'sadjow.com',
port: 3000
});
@sadjow
sadjow / rmagick.sh
Created January 25, 2013 17:50 — forked from zoras/rmagick.sh
sudo apt-get install libdjvulibre-dev libjpeg-dev libtiff-dev libwmf-dev libmagickcore-dev libmagickwand-dev libmagick++-dev rvm
sudo gem install rmagick
ok!
Fetching: rmagick-2.13.1.gem (100%) Building native extensions. This could take a while ... Successfully installed rmagick-2.13.1 1 gem installed
require 'RMagick' #=> true
@sadjow
sadjow / truncate.haml
Last active December 12, 2015 04:38
Truncate a text with HTML/HAML
= raw truncate(strip_tags(item.description), :length => 90, :omission => '... ')
@sadjow
sadjow / _addthis.haml
Created February 7, 2013 20:33
AddThis HAML Buttons
%a.addthis_button_facebook_like{"addthis:url" => product_url(p), "fb:like:layout" => "button_count"}
%a.addthis_button_tweet{'tw:text' => "#{p.name} #{app_title}: #{product_url(p)}"}
@sadjow
sadjow / bootstrap_pagination.html
Created February 15, 2013 19:43
Default bootstrap markup for pagination
<div class="pagination">
<ul>
<li class="prev disabled"><span>previous</span></li>
<li class="active"><span>1</span></li>
<li><a rel="next" href="">2</a></li>
<li class="next"><a rel="next" href="">next</a></li>
</ul>
@sadjow
sadjow / load_addthis_after_ajax_calls.js
Created April 1, 2013 15:23
Dynamic load addthis tag after ajax calls
$(document).ajaxStop(function() {
if (window.addthis) {
window.addthis = null;
window._adr = null;
window._atc = null;
window._atd = null;
window._ate = null;
window._atr = null;
window._atw = null;
@sadjow
sadjow / deploy.rb
Created April 11, 2013 21:13
Capistrano configuration file.
require "bundler/capistrano"
#set :rvm_ruby_string, "1.9.3"
set :rvm_type, :system
set :use_sudo, false
default_run_options[:pty] = true
set :shared_children, shared_children + %w{public/uploads}
@sadjow
sadjow / functions.js
Created May 10, 2013 00:03
Update a JavaScript object with a dotted path string. You pass the string path and the object you want.,
// company = {}
// Use putObject("owner.name", company,"Sadjow");
// Returns {owener: {name: "Sadjow"}}
function putObject(path, object, value) {
var modelPath = path.split(".");
function fill(object, elements, depth, value) {
var hasNext = ((depth + 1) < elements.length);
if(depth < elements.length && hasNext) {