Skip to content

Instantly share code, notes, and snippets.

View chrisenytc's full-sized avatar
👨‍💻
Building a new society

Christopher Enytc chrisenytc

👨‍💻
Building a new society
View GitHub Profile
@tanepiper
tanepiper / twitter_oauth_getter.js
Created September 11, 2010 16:14
A small command line nodejs script for doing Twitter OAuth.
#!/usr/bin/env node
var argv = require('optimist')
.usage('Usage: --key=[consumer key] -secret=[consumer secret]')
.demand(['key', 'secret'])
.argv
;
var OAuth = require('oauth').OAuth;
var Step = require('step');
@ar
ar / Parity.java
Created January 23, 2011 00:42
Adjust parity
public class Util {
/**
* DES Keys use the LSB as the odd parity bit. This method can
* be used enforce correct parity.
*
* @param bytes the byte array to set the odd parity on.
*/
public static void adjustDESParity (byte[] bytes) {
for (int i = 0; i < bytes.length; i++) {
@robotlolita
robotlolita / 0-source.coffee
Last active December 27, 2015 02:32
CoffeeScript parser absurdity
[
a: 1
, b: 2
, c: 3
]
[ a: 1
, b: 2
, c: 3
]
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@border
border / mgoExample.go
Created August 27, 2012 15:33
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@aheckmann
aheckmann / mongoose_with_mongo2-2_elemMatch_projection.js
Created September 5, 2012 17:31
using the $elemMatch projection with mongoose
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert')
console.log('\n===========');
console.log(' mongoose version: %s', mongoose.version);
console.log('========\n\n');
var dbname = 'testing_1085';
mongoose.connect('localhost', dbname);
@masonforest
masonforest / gist:4048732
Created November 9, 2012 22:28
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

@angelochen960
angelochen960 / gist:4188293
Created December 2, 2012 11:29
AngularJS using [[]] as data binding symbols
<!doctype html>
<html ng-app="myApp">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<script type="text/javascript">
var myApp = angular.module('myApp', [], function ($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
});
@theangryangel
theangryangel / AuthController.js
Created February 28, 2013 21:54
sails (v0.8.82) + passport + passport-local Rough Example. For the love of all that is holy, don't use this in production.
// api/controllers/AuthController.js
var passport = require('passport');
var AuthController = {
login: function (req,res)
{
res.view();
},
@ryanhanwu
ryanhanwu / httpsExpressApp.js
Created April 5, 2013 17:57
Express JS HTTP + HTTPs server (including auto redirect)
var express = require('express'),
routes = require('./routes'),
upload = require('./routes/upload'),
http = require('http'),
https = require('https'),
fs = require('fs'),
path = require('path'),
httpApp = express(),
app = express(),
certPath = "cert";