Skip to content

Instantly share code, notes, and snippets.

View ephbaum's full-sized avatar

Eph Baum ephbaum

View GitHub Profile
@ephbaum
ephbaum / jQuery.exists()
Created April 9, 2014 14:37
jQuery.exists Extension
/* Extend jQuery slightly to determine existence of element */
jQuery.fn.exists = function() {
return this.length > 0;
}
/* How to implement... */
if ($(selector).exists()) {
// Do something
}
@ephbaum
ephbaum / po_mans_logger.js
Last active August 29, 2015 14:12
Po' Man's Logger
;/* @po_mans_logger CurrentlyExecutingMethodName */; console.log( 'CurrentlyExecutingMethodName Scope' ); console.dir( { $parent: $parent, this: this } );/* @todo Remove - C'mon, you're better than this. */;
@ephbaum
ephbaum / index.html
Last active August 29, 2015 14:13
thingdom-js example
<body><nav class="navbar navbar-inverse navbar-fixed-top"><div class="container"> <div class="navbar-header"><a class="navbar-brand" href="https://github.com/thingdomio/thingdom-js">Thingdom-JS Example</a> </div><div id="navbar" class="navbar-collapse collapse"></div> </nav>
<div class="jumbotron">
<div class="container">
<h1>Welcome to Thingdom</h1>
<h3 class="text-muted">a thingdom-js example</h3>
<p class="well">... being a simple example of how to use the thingdom-js library in your own project to trigger push notifications, a realtime updating feed of content / data, and realtime status from within your webapp without extra sever-side configuration. As a front-end developer there are always challenges you encounter that cannot be solved simply in the front-end for a variety of reasons; some of those problems <em>could</em> be solved by using Thingdom in your project!</p><a class="btn btn-primary btn-lg" href="#" role="button">Call to Action</a>
</div> <!-- /.container -->
<
@ephbaum
ephbaum / index.html
Last active August 29, 2015 14:13
thingdom-js example
<body>
<nav class="navbar navbar-inverse navbar-fixed-top"><div class="container"> <div class="navbar-header"><a class="navbar-brand" href="https://github.com/thingdomio/thingdom-js">Thingdom-JS Example</a> </div><div id="navbar" class="navbar-collapse collapse"></div> </nav>
<div class="container">
<div id="thingdom" class="panel panel-default">
<div class="hidden panel-heading"><h2 class="panel-title">Real Codes Already?</h2></div>
<div class="panel-body">
<p><strong>Step One: Authenticate and initialize Thingdom</strong></p>
<p>You&#39ll want to instantiate a new Thingdom object by passing in your API Secret:</p>
@ephbaum
ephbaum / translate3dPageTransitions.css
Last active August 29, 2015 14:14
use 3d page transitions for mobile ui
.page {
position: absolute;top: 0;left: 0;width: 100%;height: 100%;
transform: translate3d(0, 0, 0);
}
.left {
transform: translate3d(-100%, 0, 0);
}
.center {
transform: translate3d(0, 0, 0);
}
@ephbaum
ephbaum / noselect.css
Created February 22, 2015 04:36
.noselect
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/*
Include this after bootstrap.css
Add a class of 'col-xs-offset-*' and
if you want to disable the offset at a larger size add in 'col-*-offset-0'
Examples:
All display sizes (xs,sm,md,lg) have an offset of 1
<div class="col-xs-11 col-xs-offset-1 col-sm-3">
@ephbaum
ephbaum / typicalValidEmailFormatRegExp.js
Last active August 29, 2015 14:16
typicalValidEmailFormatRegExp
var typicalValidEmailFormatRegExp = /(^[\S]+@[\S]+\.[\S]{2,63}$)/; // @fskirschbaum || My RegExp could beat up your RegExp. Fight Me. || Says, essentialy, a bunch of characters, an @ symbol, a bunch more characters, a single dot, ends with a group of characters between 2 and 63 (the allowed min/max size of valid .tld ). Allows a hefty chunk of expected valid email addresses, disallows most typical user error type input of invalid email address. boom.
if ( ___VAR___.match( typicalValidEmailFormatRegExp ) === null ) { return false; }
// see example here: @link https://regex101.com/r/vD9zK7/4
@ephbaum
ephbaum / simpleRFC2822EmailRegExp.js
Last active August 29, 2015 14:16
simpleRFC2822EmailRegExp
var simpleRFC2822EmailRegExp = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/
if ( ____placeholder____.match( complexRFX2822EmailRegExp ) === null ) { return false; }
// see data @link https://regex101.com/r/uU1fI9/1
@ephbaum
ephbaum / complexRFX2822EmailRegExp.js
Last active August 29, 2015 14:16
complexRFX2822EmailRegExp.js
var complexRFX2822EmailRegExp = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;
if ( ____placeholder____.match( complexRFX2822EmailRegExp ) === null ) { return false; }
// see data @link https://regex101.com/r/oJ8nO1/1