Skip to content

Instantly share code, notes, and snippets.

DEV .gitignore
`build/*`
Prod/master .gitignore
(empty)
Make changes to files in dev and commit.
Checkout master. Merge changes from dev. Run gulp to create the `build/` files -- commit the result and push
@timelf123
timelf123 / WebSockets.md
Created January 4, 2016 02:26 — forked from subudeepak/WebSockets.md
The problems and some security implications of websockets - Cross-site WebSockets Scripting (XSWS)

WebSockets - An Introduction

WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions

  • The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
  • This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
  • This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t
@timelf123
timelf123 / on-jsx.markdown
Created January 4, 2016 02:26 — forked from chantastic/on-jsx.markdown
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I lead the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can'

@timelf123
timelf123 / introrx.md
Created January 4, 2016 02:26 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
#!/bin/bash
# This little hack-job will grab credentials from a running openvpn process in Linux
# Keep in mind this won't work if the user used the --auth-nocache flag
grep rw-p /proc/$1/maps | sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' | while read start stop; do gdb --batch-silent --silent --pid $1 -ex "dump memory $1-$start-$stop.dump 0x$start 0x$stop"; done
echo "Your credentials should be listed below as username/password"
strings *.dump | grep -B2 KnOQ | grep -v KnOQ
rm *.dump --force
@timelf123
timelf123 / clone-all-twitter-github-repos.sh
Created December 23, 2015 17:23 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
idea: function(req, res, next, id) {
if (!req.challenge) return next(new Error('Failed to load challenge idea ' + id));
var challenge = req.challenge;
req.idea = challenge.ideas.id(id); // DocumentArrays have a special id method for looking up a document by its _id.
// req.idea = challenge.ideas.id(id).populate('user', 'name username') this is what I want to do
next();
@timelf123
timelf123 / search-queries-in-google-docs
Created December 17, 2015 21:51 — forked from derekmartinla/search-queries-in-google-docs
Perform Search Query Analysis In One Google Doc
/**********************************************************************************************
* AdWords Account Management -- Review Search Queries & Post Adjustments via Google Docs.
* Version 1.0
* Created By: Derek Martin
* DerekMartinLA.com & MixedMarketingArtist.com
*********************************************************************************************/
var GOOGLE_DOC_URL = "put your url here";
var START_DATE = '20150401';
var END_DATE = '20150415';
@timelf123
timelf123 / gist:6723ceae6ee32bce39b5
Created December 10, 2015 01:19 — forked from derekmartinla/gist:c660f7d326a04e2d418e
Ad-Group Callout Extension Example
// Set callout extensions on the ad group level for all active ad groups based on text sent in createCallouts()
// Change campaign selection criteria as needed
function main() {
campIter = AdWordsApp.campaigns().withCondition("CampaignName contains Brand").withCondition("CampaignName does_not_contain Remarketing").get();
var callouts = createCallouts();
while (campIter.hasNext()) {
camp = campIter.next();
@timelf123
timelf123 / gist:a61a1088830fcbb2b431
Created December 10, 2015 01:19 — forked from derekmartinla/gist:46bbbcd2e800111fd46f
Copy Existing AdWords Ads With A New Destination URL
function main() {
// change the CampaignName condition to whatever suits you
var adIter = AdWordsApp.ads().withCondition("CampaignName contains WP").withCondition("Status = ENABLED").get();
while(adIter.hasNext()) {
var ad = adIter.next();
var headline = ad.getHeadline();
var d1 = ad.getDescription1()
var d2 = ad.getDescription2();