Skip to content

Instantly share code, notes, and snippets.

View raddevon's full-sized avatar

Devon Campbell raddevon

View GitHub Profile
@samuelhei
samuelhei / passport-config.js
Created August 12, 2015 14:29
Passport config for local authentication with Amazon Dynamodb
/*
Passport config for local authentication with Amazon Dynamodb
*/
var passport = require("passport");
var LocalStrategy = require('passport-local').Strategy;
var path = require('path');
var User = require(path.join(__dirname, '/class/User'));
@artjomb
artjomb / 1_phantomErrors.js
Last active April 5, 2022 22:10
Error event handlers for PhantomJS and CasperJS: PhantomJS and CasperJS don't show errors on the page by default. This can give clues as to what did go wrong.
var page = require('webpage').create(),
url = 'http://example.com/';
// Put the event handlers somewhere in the code before the action of
// interest (opening the page in question or clicking something)
// http://phantomjs.org/api/webpage/handler/on-console-message.html
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
};
// example function where arguments 2 and 3 are optional
function example( err, optionalA, optionalB, callback ) {
// retrieve arguments as array
var args = [].slice.call(arguments);
// first argument is the error object
// shift() removes the first item from the
// array and returns it
err = args.shift();
@asiermarques
asiermarques / gist:21431cc61e90d57ac927
Last active August 3, 2016 22:57
openlayers draggable "marker"
var initMap = function(){
var Lon = -2.93 ;
var Lat = 43.2629642;
var Zoom = 14;
var EPSG4326 = new OpenLayers.Projection( "EPSG:4326" );
var EPSG900913 = new OpenLayers.Projection("EPSG:900913");
var LL = new OpenLayers.LonLat( Lon, Lat );
var XY = LL.clone().transform( EPSG4326, EPSG900913 );
@derekseymour
derekseymour / freshdesk_sso.js
Last active June 17, 2020 15:59
Freshdesk Single Sign On URL - Node.js
var crypto = require('crypto');
/**
* Generates and returns a Freshdesk Single Sign On URL
* {@link https://gist.github.com/derekseymour/26a6fe573c1274642976 Gist}
*
* @author Derek Seymour <derek@rocketideas.com>
* @param {String} name - The name of the user logging in.
* @param {String} email - A valid email address to associate with the user.
@Bouke
Bouke / gist:10454272
Last active September 22, 2023 17:23
Install FreeTDS, unixODBC and pyodbc on OS X

First, install the following libraries:

$ brew install unixodbc
$ brew install freetds --with-unixodbc

FreeTDS should already work now, without configuration:

$ tsql -S [IP or hostname] -U [username] -P [password]
locale is "en_US.UTF-8"

locale charset is "UTF-8"

@ejdyksen
ejdyksen / patch-edid.md
Last active March 19, 2024 09:53
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@julionc
julionc / 00.howto_install_phantomjs.md
Last active February 21, 2024 11:01
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@tdominey
tdominey / gist:6066495
Created July 23, 2013 21:52
Display siblings of album from parent set
<koken:parent>
<p>
<strong>From the set:</strong> <koken:link title="View {{ album.title }}">
{{ album.title }}</koken:link>
</p>
<p>
<strong>Other albums in this set:</strong>
<koken:loop>
<koken:link>{{ album.title }}</koken:link>
</koken:loop>
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: