Skip to content

Instantly share code, notes, and snippets.

View dsimmons's full-sized avatar
👍

Dan Simmons dsimmons

👍
View GitHub Profile

Keybase proof

I hereby claim:

  • I am dsimmons on github.
  • I am simmons_dan (https://keybase.io/simmons_dan) on keybase.
  • I have a public key ASBdSLHj1UQnXwnJApiDmBzRjCJTgexiWXIufbgDd1MT9wo

To claim this, I am signing this object:

@dsimmons
dsimmons / react-ssr.js
Created January 18, 2015 18:19
React Async SSR
module.exports.render = function renderFn(url) {
var bodyHTML;
if (ExecutionEnvironment.canUseDOM) {
Router.run(Routes, Router.HistoryLocation, (Handler, state) => {
bodyHTML = React.render(<Handler params={state.params}/>, document.body);
});
} else {
Router.run(Routes, url, (Handler, state) => {
var promises = state.routes
.filter(route => route.handler.fetchData)
dump = require('utils').dump
entries = []
casper = require('casper').create {
verbose: true
logLevel: 'debug'
}
casper.start 'http://www.yahoo.com', ->
@fill 'form', p: 'van pham tapjoy'
@dsimmons
dsimmons / stats.js
Last active August 29, 2015 13:59
Rev.com browser console stats
$rows = $('#orders-history tbody tr');
// Sum the cost of all orders placed.
costTotal = [].reduce.call($('td:nth-child(7)', $rows).map(function(i, el) { return Number(el.innerHTML.replace(/[^0-9\.]+/g, "")); }), function(sum, current) { return sum + current; })
// Average audio file duration
avgDuration = costTotal / $rows.length;
console.log("Total cost: $" + costTotal);
console.log("Average call duration: " + avgDuration + "m");
parseRoute: (route) ->
next = do ->
regex = /([^/]*[^/])/g
return -> ((arg) -> arg).apply(this, regex.exec(route)?.slice(1))
(function(Console) {
Console.COUNTRY_CODES = {
'US': 'United States',
'EN': 'United Kingdom'
}
})(this.Console)
@import '../variables.sass'
#widgets
.flow
background-color: #ddd
max-width: 1024px
margin-bottom: 1em
article.container
background-color: white
@dsimmons
dsimmons / results.md
Created November 20, 2012 21:00
With and without localeapp daemon running.

Rewarded Installs

Without daemon

CTRL + R
- Load time #1: 8.81s (8.9s)
- Load time #2: 9.59s (9.63s)
- Load time #3: 9.88s (9.98s)
- Load time #4: 9.79s (9.89s)
@dsimmons
dsimmons / gist:4043002
Created November 9, 2012 00:49
Vagrant NFS
# Make Vagrant faster!
config.vm.network :hostonly, "33.33.33.10"
config.vm.share_folder("v-root", "/vagrant", ".", :nfs => true)
@dsimmons
dsimmons / socket_example.js
Created October 19, 2012 15:17
Socket.io Client Example
socket = io.connect('http://localhost:3000');
socket.on('connect', function() {
console.log("Connected to the server!");
socket.emit('command', 'someVar = 5');
socket.on('result', function(result) {
console.log("Received result:", result);
});
});