Skip to content

Instantly share code, notes, and snippets.

View jondavidjohn's full-sized avatar

Jonathan D. Johnson jondavidjohn

View GitHub Profile
@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 / 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());
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 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();
@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:

$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 / component.js
Created July 10, 2011 04:46
Javascript Component Starting point
var component = (function($){
var default_options = {
array_option : [],
string_option : "default"
};
return {
other_function: function(args) {
@jondavidjohn
jondavidjohn / multi-form-submit.js
Created July 13, 2011 15:46
Submit Multiple Forms via AJAX
$('button').click(function() {
$('form').each(function() {
var action = $(this).attr("action");
var data = $form.serialize();
$.post(action, data);
});
});
@jondavidjohn
jondavidjohn / .bash_profile
Created July 20, 2011 18:34
Bash Alias to check for php errors on all Modified Files
function gitphpcheck () {
filearray=()
while read line; do
if [[ $line =~ ^(M|N) ]]
then
filename="`echo $line | awk '{ print $2 }'`"
filearray+=($filename)
@jondavidjohn
jondavidjohn / .profile
Created July 21, 2011 03:46
Include current Git branch in prompt
# this snippet rewrites your prompt to include the current branch if in a git repo
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\[\e[01;33m\]\w \$(parse_git_branch): \[\e[00m\]"