Skip to content

Instantly share code, notes, and snippets.

View thoughtpalette's full-sized avatar

Christopher Marshall thoughtpalette

View GitHub Profile
@thoughtpalette
thoughtpalette / tracking
Last active August 29, 2015 13:57
GA Click Tracking, Scroll Tracking and YouTube Video (play/complete) tracking for Single and Multiple Videos
var asyncYouTubeApiLoad = function() {
//https://developers.google.com/youtube/iframe_api_reference
// This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
};
var initiateVideoTracking = function() {
@thoughtpalette
thoughtpalette / Gruntfile.js
Last active August 29, 2015 14:04
Default Gruntfile
module.exports = function( grunt )
{
// Project configuration
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
watch:
{
livereload: {
options: {livereload: true},
files: ['source/**/*']
@thoughtpalette
thoughtpalette / twilio-post
Created August 6, 2014 20:19
Twilio API jQuery Post
// Had issues with CORS when implementing different post types and changing headers in node/express/angular.$http, this works even though it still gives me the CORS error.
$.ajax({
type: "POST",
username: "[ACCOUNT_SID]",
password: "[AUTH_TOKEN]",
url: "https://api.twilio.com/2010-04-01/Accounts/[SID_HERE]/SMS/Messages",
xhrFields: {
withCredentials: true
},
@thoughtpalette
thoughtpalette / state-select-directive
Created September 16, 2014 22:23
AngularJS State Select Menu Directive.
dirMod.directive( "stateselectmenu", function ()
{
return {
restrict: "A",
template: "<option value='AL'>Alabama</option><option value='AK'>Alaska</option><option value='AZ'>Arizona</option><option value='AR'>Arkansas</option> <option value='CA'>California</option> <option value='CO'>Colorado</option> <option value='CT'>Connecticut</option> <option value='DE'>Delaware</option> <option value='DC'>District Of Columbia</option> <option value='FL'>Florida</option> <option value='GA'>Georgia</option> <option value='HI'>Hawaii</option> <option value='ID'>Idaho</option> <option value='IL'>Illinois</option> <option value='IN'>Indiana</option> <option value='IA'>Iowa</option> <option value='KS'>Kansas</option> <option value='KY'>Kentucky</option> <option value='LA'>Louisiana</option> <option value='ME'>Maine</option> <option value='MD'>Maryland</option> <option value='MA'>Massachusetts</option> <option value='MI'>Michigan</option> <option value='MN'>Minnesota</option> <option value='MS'>Mississippi</option> <
@thoughtpalette
thoughtpalette / startup-video-notes
Last active August 29, 2015 14:06
Notes on how to start a startup video.
Video: [How to start a startup](https://www.youtube.com/watch?v=CBYhVcO4WgI)
Notes by: [philipDS](https://news.ycombinator.com/user?id=philipDS)
# 4 critical parts: Idea, Team, Product, Execution
## 1. Idea
-> Good startups take about 10 years
-> Startup should feel like an important mission
@thoughtpalette
thoughtpalette / emoji-list.json
Created November 4, 2014 22:30
emoji list ment.io support
// http://jeff-collins.github.io/ment.io/#/
var emojis = [
{ "label" : "bowtie" },
{ "label" : "smile" },
{ "label" : "laughing" },
{ "label" : "blush" },
{ "label" : "smiley" },
{ "label" : "relaxed" },
{ "label" : "smirk" },
var $updatePasswordContainer = $( ".update-password" ),
$savePasswordBtn = $( ".save-password" );
$cancelEditBtn = $( ".cancel-password" );
var updatePasswordSection = {
toggle: function( parentEl, initialValue )
{
if ( $updatePasswordContainer.hasClass( "editing" ) )
{
var $updatePasswordContainer = $( ".update-password" ),
$savePasswordBtn = $( ".save-password" );
$cancelEditBtn = $( ".cancel-password" );
var updatePasswordSection = {
toggle: function( parentEl, initialValue )
{
if ( $updatePasswordContainer.hasClass( "editing" ) )
{
var $updatePasswordContainer = $( ".update-password" ),
$savePasswordBtn = $( ".save-password" ),
$cancelEditBtn = $( ".cancel-password" );
var updatePasswordSection = {
toggle: function( parentEl, initialValue )
{
if( $updatePasswordContainer.hasClass( "editing" ) )
{
Lifecycle Methods
componentWillMount – Invoked once, on both client & server before rendering occurs.
componentDidMount – Invoked once, only on the client, after rendering occurs.
shouldComponentUpdate – Return value determines whether component should update.
componentWillUnmount – Invoked prior to unmounting component.
Specs
getInitialState – Return value is the initial value for state.
getDefaultProps – Sets fallback props values if props aren’t supplied.