Skip to content

Instantly share code, notes, and snippets.

View faddai's full-sized avatar

Francis Addai faddai

View GitHub Profile
@faddai
faddai / app.js
Last active August 29, 2015 14:25 — forked from khash/app.js
Cloud 66 Status Page Source Code
Handlebars.registerHelper('equal', function(lvalue, rvalue, options) {
if (arguments.length < 3)
throw new Error("Handlebars Helper equal needs 2 parameters");
if( lvalue!=rvalue ) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
@faddai
faddai / bash-aliases
Last active December 16, 2015 07:59
Bash alias for working in the terminal.
alias c="clear"
alias ll="ls -alH"
# Git Alias
alias gb="git branch"
alias gs="git status"
alias gss="git status -s"
alias gc="git checkout"
alias gbn="git checkout -b"
alias gd="git diff"
@faddai
faddai / gist:4223224
Created December 6, 2012 09:28 — forked from inklesspen/gist:4222841
ACLs, context objects, and URL Dispatch in Pyramid
# A worked example based on http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/urldispatch.html#using-pyramid-security-with-url-dispatch
# in your configuration section (typically in myapp/__init__.py)
config.add_route('articles.edit', 'article/{id}/edit', factory='myapp.acl.ArticleACL')
# in myapp/acl.py
class ArticleACL(object):
def __init__(self, request):
# First, we assume this ACL object is used only in routes that provide an article id; if need be, you can add some sanity checking here, or some if/else branching
@faddai
faddai / gist:3928884
Created October 21, 2012 23:14
Contains mime types to be used on ubuntu server.
jk###############################################################################
#
# MIME-TYPES and the extensions that represent them
#
# This file is part of the "mime-support" package. Please send email (not a
# bug report) to mime-support@packages.debian.org if you would like new types
# and/or extensions to be added.
#
# The reason that all types are managed by the mime-support package instead
# allowing individual packages to install types in much the same way as they
@faddai
faddai / gist:3185713
Created July 27, 2012 01:41 — forked from remy/gist:350433
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@faddai
faddai / gpa_calculator.js
Created May 1, 2012 12:29 — forked from ranskills/gpa_calculator.js
GPA Calculator In JavaScript
var gradeLetters = ['a', 'b+', 'b', 'c+', 'c', 'd', 'f', 'af', 'wf'],
gradePoints = [4, 3.5, 3, 2.5, 2, 1, 0, 0, 0];
function getNumCoursesToBeEntered() {
"use strict";
var numCourses = 0,
input = "";
do {
input = prompt("Enter number of subjects?");