Skip to content

Instantly share code, notes, and snippets.

View srhyne's full-sized avatar
🏠
Working from home

Stephen Rhyne srhyne

🏠
Working from home
View GitHub Profile
var items = input.your_string_array.split("\n\n").map(function(i){
var _i = {};
i.split("\n").forEach(function(kv){
kv = kv.split(':');
_i[kv[0].trim()] = kv[1].trim();
});
return _i;
});
@srhyne
srhyne / three-things-today.html
Created March 16, 2016 16:01
An extremely minimal task checklist. The three things you want to accomplish today. Inspired by @ALOProductivity
<!DOCTYPE html>
<html>
<head>
<title>Three Things Today!</title>
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<style>
body{
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif
}
@srhyne
srhyne / gist:478f68bb3a7375ad9442
Created September 25, 2015 19:17
Setting up Conveyour.identify with backend data
This is an appendix to [conveyour-analytics-with-javascript](http://conveyour.com/help/conveyour-analytics-with-javascript).
See step 3. How do you get the user data into that Conveyour.identify call?
The steps
- In your PHP file gather the desired user meta data
- Echo the gathered data out as a JSON variable in your PHP file
- Use that new javascript object as a reference in the identify call.
Example
@srhyne
srhyne / conveyour-track-link.js
Created September 25, 2015 19:05
track events on anchor links
@srhyne
srhyne / iso-3166-country-codes.txt
Created March 6, 2014 18:08
ISO 3166-1 Country Codes
AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW
@srhyne
srhyne / jquery.validateZform.js
Created January 15, 2013 20:18
Overriding Zoho Creator's js form validation
$(function(){
//this is our function we pass to the onSubmit
function validateForm (e) {
var _this, data;
e.preventDefault();
_this = $(this);
data = {};
@srhyne
srhyne / bean.rb
Created June 21, 2012 17:14
Diff last commit on Beanstalk server with local head
#!/usr/bin/env ruby
require 'rubygems'
require 'beanstalkapp'
Beanstalk::API::Base.setup(
:domain => "your_beanstalk_account_subdomain",
:login => "login",
:password => ENV['BEANSTALK_PW']
)
@srhyne
srhyne / jquery.event.fastfix.js
Created June 19, 2012 17:56
jquery.event.fastfix
// - jquery.event.fastfix.js
(function () {
// http://bitovi.com/blog/2012/04/faster-jquery-event-fix.html
// https://gist.github.com/2377196
// IE 8 has Object.defineProperty but it only defines DOM Nodes. According to
// http://kangax.github.com/es5-compat-table/#define-property-ie-note
// All browser that have Object.defineProperties also support Object.defineProperty properly
if(Object.defineProperties) {
var
@srhyne
srhyne / string.tmpl.js
Created December 29, 2011 18:53
Super simple JS templates with String.prototype.tmpl using Ruby/coffeeScript syntax
String.prototype.tmpl = function(obj){
var str, keys, _do;
//store string
str = this.toString();
//if no object just return string
if(!obj || typeof obj !== "object"){
return str;
}
@srhyne
srhyne / app.js
Created November 1, 2011 20:02 — forked from aaronksaunders/app.js
example app using appcelerator stackmob module
//
// APPCELERATOR - STACKMOB IOS MODULE
//
// aaron@clearlyinnovative.com
// blog.clearlyinnovative.com
//
// http://stackmob.com
//
var window = Ti.UI.createWindow({
backgroundColor: 'white'