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
@srhyne
srhyne / $extend_dom.js
Created November 15, 2010 04:03
Using jQuery $.extend method to change DOM attributes..
// 1. DOUBLE BAD!!
$("#myLink").attr("name","srhyne");
$("#myLink").attr("href","http://stephenrhyne.com";
$("myLink").html("stephenrhyne.com");
// 2. IN MY OPINION STILL VERY BAD..
$("#mylink")
.attr("name","srhyne")
@srhyne
srhyne / conveyour-track-link.js
Created September 25, 2015 19:05
track events on anchor links
@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 / record_interval_check.html
Created October 5, 2011 20:53
Refresh Parent Zoho Creator HTML view w/ JSON Check
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Page Refresh</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(function(){
var zoho, url, request;
zoho = {
@srhyne
srhyne / jquery.data.expr.js
Created October 27, 2011 23:27
jQuery :data selector
// Wrap in self-invoking anonymous function:
(function($){
// Extend jQuery's native ':'
$.extend($.expr[':'],{
// New method, "data"
data: function(a,i,m) {
var e = $(a).get(0), keyVal;
@srhyne
srhyne / jsfuncperf.js
Created October 29, 2011 17:30
JS Perf Notes closures & anon functions
// avoid using anon function cb's for high touch events
$("div").mousemove(function(){
//this function is re-created every time w/ obvious overhead
});
//avoid re-creating Class methods in a constructor pattern. Use prototype instead
//instead of this...
function Person(first, last){
@srhyne
srhyne / jquery.ba-tinypubsub.js
Created November 1, 2011 03:40 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@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'
@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 / 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