Skip to content

Instantly share code, notes, and snippets.

Avatar

Sam Deering sdeering

View GitHub Profile
@sdeering
sdeering / gist:7153714
Last active Dec 26, 2015
Basic Node.js Crypto Cipher Encryption Example
View gist:7153714
var cryptojs = require('crypto')
, salt = "<client app salt token>"
, keyIterations = 1000 //number of interations to generate your key
, keyLength
, key
, password
, cipher
, msg = "<what you want to encrypt>"
, encryptedMsg;
@sdeering
sdeering / gist:7459478
Created Nov 14, 2013
Capture iPad device change (IOS7) tested.
View gist:7459478
//capture ipad device change (IOS7) tested.
function doOnOrientationChange()
{
// alert(window.orientation);
switch(window.orientation)
{
case 0:
case 90:
// alert('portrait');
$('html').removeClass('landscape').addClass('portrait');
View gist:7459482
/*
http://www.jquery4u.com/snippets/url-parameters-jquery/
*/
$.urlParam = function(name){
var results = new RegExp('[\\?&amp;]' + name + '=([^&amp;#]*)').exec(window.location.href);
return results[1] || 0;
}
@sdeering
sdeering / tmux.conf
Created Nov 28, 2013
My Tmux Config Linux
View tmux.conf
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# quick pane cycling
@sdeering
sdeering / gist:8035033
Created Dec 19, 2013
Use grunt connect to make the karma test coverage directory browseable.
View gist:8035033
coverage: {
options: {
// required for output on index.html base filepath
base: __dirname + 'test/coverage/',
// required to override base to make the directory browseable
directory: __dirname + 'test/coverage/',
port: '5555',
keepalive: true
}
}
@sdeering
sdeering / gist:8437725
Created Jan 15, 2014
Some .bashrc git alias commands
View gist:8437725
#-------------------------------------------------------------
# Git Alias Commands
#-------------------------------------------------------------
alias g="git status"
alias ga="git add"
alias gaa="git add ."
alias gau="git add -u"
alias gc="git commit -m"
alias gca="git commit -am"
alias gb="git branch"
@sdeering
sdeering / gist:11131879
Created Apr 21, 2014
node.js xhr with promises using q library
View gist:11131879
function _functionName(url) {
return Q.fcall(function () {
var deferred = Q.defer();
var options = {
url: url,
headers: {
'User-Agent': 'my-app'
},
@sdeering
sdeering / .htaccess
Created Aug 11, 2014
Laravel 4 with AngularJS Architecture Solution .htaccess
View .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect root requests
RewriteCond %{REQUEST_URI} ^/$
RewriteRule !^/ /back-end/public%{REQUEST_URI} [L]
@sdeering
sdeering / gist:4356baed3692d26ab778
Created Aug 11, 2014
injectorsauce with meta tag check
View gist:4356baed3692d26ab778
/**
* CSRF Token Security.
*/
(function() {
angular.module("app").config(['$httpProvider', function ($httpProvider) {
//check for token in meta tag
var csrf_token = $('meta[name=csrf-token]').attr('content');
View console-sass-version.json
{
"minimum_web_client_version": "master-1094"
}
You can’t perform that action at this time.