Skip to content

Instantly share code, notes, and snippets.

View osahyoun's full-sized avatar

Omar Sahyoun osahyoun

View GitHub Profile
@osahyoun
osahyoun / rss template jekyll
Created August 4, 2012 09:57
Valid RSS Feed Template for Jekyll
---
layout: foobar
---
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ site.name }} - Latest Posts</title>
<description>{{ site.description | xml_escape }}</description>
<link>{{ site.url }}</link>
<atom:link href="{{ site.feed_url }}" rel="self" type="application/rss+xml" />
feature_branch() {
if [ "${1}" = "" ]; then
echo "${0} <new feature branch name>"
return
fi
branch_name="`date '+%d%m%y'`_${1}"
git co -b ${branch_name} master
git push
git branch --set-upstream ${branch_name} origin/${branch_name}
@osahyoun
osahyoun / gist:3236111
Created August 2, 2012 10:23
JSON#stringify
var javascript_obj = {animal: 'Zebra'};
typeof javascript_obj;
// "object"
var json_obj = JSON.stringify(javascript_obj);
typeof json_obj;
// "string"
@osahyoun
osahyoun / Gemfile
Created June 27, 2012 14:37 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'
@osahyoun
osahyoun / usage resource
Created March 14, 2011 11:35
usage XML representation
<?xml version="1.0" encoding="UTF-8"?>
<usage>
<metric>
<id>16</id>
<name>Hits</name>
<unit>hit</unit>
</metric>
<period>
<since>2011-02-01 00:00:00 UTC</since>
<until>2011-02-07 23:59:59 UTC</until>
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {