Skip to content

Instantly share code, notes, and snippets.

View avoidwork's full-sized avatar

Jason Mulligan avoidwork

View GitHub Profile
@csanz
csanz / encrypt_decrypt.js
Created August 30, 2011 16:06
Simple String Encryption & Decryption with Node.js
function encrypt(text){
var cipher = crypto.createCipher('aes-256-cbc','d6F3Efeq')
var crypted = cipher.update(text,'utf8','hex')
crypted += cipher.final('hex');
return crypted;
}
function decrypt(text){
var decipher = crypto.createDecipher('aes-256-cbc','d6F3Efeq')
var dec = decipher.update(text,'hex','utf8')
@bellbind
bellbind / es5compat-gs.js
Created May 31, 2011 15:45
[js]Missing ECMAScript5 standard function for Opera11 and Safari5
(function (global) {
// Missing ECMAScript5 standard functions for Opera and Safari
// support getter/setter with non standard funcs
// add the script tag to html at first:
// <script src="https://gist.github.com/raw/1000718/es5compat-gs.js"
// ></script>
// dummy Object protection interface for Opera11 and Safari5
Object.isFrozen = (
Object.isFrozen || function isFrozen(obj) {return false;});
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {