Skip to content

Instantly share code, notes, and snippets.

View jondavidjohn's full-sized avatar

Jonathan D. Johnson jondavidjohn

View GitHub Profile
@jondavidjohn
jondavidjohn / keybase.md
Created September 1, 2016 16:48
keybase.md

Keybase proof

I hereby claim:

  • I am jondavidjohn on github.
  • I am jondavidjohn (https://keybase.io/jondavidjohn) on keybase.
  • I have a public key whose fingerprint is 4E8A 39AD 82DD 34CB 8CA3 EDA4 3A65 909D EF42 7B0C

To claim this, I am signing this object:

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $centralUrl );
curl_setopt( $ch, CURLOPT_FAILONERROR, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_TIMEOUT, 3 );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt( $ch, CURLOPT_USERPWD, $authString );
@jondavidjohn
jondavidjohn / keybase.md
Created February 10, 2015 21:50
keybase.md

Keybase proof

I hereby claim:

  • I am jondavidjohn on github.
  • I am jondavidjohn (https://keybase.io/jondavidjohn) on keybase.
  • I have a public key whose fingerprint is 2BB8 D8E8 77E8 326C 19CD B287 FA54 810B BB1F E0C0

To claim this, I am signing this object:

@jondavidjohn
jondavidjohn / index.js
Created February 5, 2015 21:36
requirebin sketch
var payform = require('payform');
var $ = require('jquery');
var domify = require('domify');
$.payform = payform;
$.payform.fn = {};
$.fn.payform = function() {
var args = [].slice.call(arguments),
method = args.shift();
SELECT entry_id, DATEDIFF(from_unixtime(field_id_162, '%Y-%m-%d'), from_unixtime(field_id_267, '%Y-%m-%d')) as days, CONVERT_TZ(from_unixtime(field_id_267, '%m/%d/%Y %h:%i %A'), 'GMT', 'CST') as start, from_unixtime(field_id_162, '%m/%d/%Y %h:%i %A') as end FROM exp_channel_data Where field_id_162 != '' AND field_id_729 != '' AND field_id_267 BETWEEN UNIX_TIMESTAMP('2015-01-01') AND UNIX_TIMESTAMP('2015-02-12')
@jondavidjohn
jondavidjohn / index.js
Created February 3, 2015 19:30
requirebin sketch
var cheerio = require('cheerio');
var $ = cheerio('<div><h1 id="hello">Header 1 with nothing <code>&lt;span&gt;sub text&lt;/span&gt;</code></h1></div>');
console.log($.find('h1').html());
console.log($.find('h1').text());
console.log($.html());
@jondavidjohn
jondavidjohn / 1 App.js
Last active August 29, 2015 14:10
React CSS (assumes browserify)
/** @jsx React.DOM */
var React = require('react'),
Toggle = require('./components/Toggle');
var App = React.createClass({
toggleChanged: function(newState) {
alert('toggle changed to ' + (newState ? 'on' : 'off'));
},
@jondavidjohn
jondavidjohn / extending_functions.js
Last active December 30, 2015 06:49
How to extend JavaScript functions
Array.prototype.join = (function(_super) {
// return our new `join()` function
return function() {
console.log("Hey, you called join!");
return _super.apply(this, arguments);
};
// Pass control back to the original join()
// by using .apply on `_super`
@jondavidjohn
jondavidjohn / gist:5114868
Created March 8, 2013 07:53
yum repolist all output
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.thelinuxfix.com
* epel: mirror.steadfast.net
* extras: centos.corenetworks.net
* updates: mirror.fdcservers.net
repo id repo name status
C6.0-base CentOS-6.0 - Base disabled
C6.0-centosplus CentOS-6.0 - CentOSPlus disabled
C6.0-contrib CentOS-6.0 - Contrib disabled
@jondavidjohn
jondavidjohn / moveAnimate.js
Last active August 23, 2019 03:20
Animate any node to a new parent
/*
Animate any Node to a new parent node, retaining original object reference
Derived From : http://stackoverflow.com/a/5212193/555384
*/
function moveAnimate($element, $newParent){
var oldOffset, newOffset, $temp;
$element = $($element); //Allow passing in either a JQuery object or selector