Skip to content

Instantly share code, notes, and snippets.

View SomeKittens's full-sized avatar

Randall Koutnik SomeKittens

View GitHub Profile
@SomeKittens
SomeKittens / promiseForLoop.js
Created May 18, 2014 06:38
for loop bluebird promise
var userPromises = [];
// For loop instead of forEach to maintain `this` value
for (var i = 0; i < users.length; i++) {
userPromises.push(this.client.queryAsync('INSERT INTO invites (customerNo, email, name)' +
' VALUES ($1, $2, $3)', [req.user.id, users[i].email, users[i].name]));
}
return bluebird.all(userPromises);
alert(1);
'use strict';
function inherits (ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
F^Crandallkoutnik: ~/runnable/angular Many-many-changes-in-e2e-tests$ npm test
> runnable-angular@0.2.1 test /Users/randallkoutnik/runnable/angular
> protractor ./test/protractor.conf.js
Using the selenium server at http://localhost:4444/wd/hub
..root@569d5461825a: /bin/sh -c sleep 123456789
..root@909f8b23ff19: /bin/sh -c sleep 123456789
@SomeKittens
SomeKittens / wat.js
Last active August 29, 2015 14:15
wat
if((parseInt(document.all.bmembers.value)!=0)&&((CheckRadioList("atitle"))||(document.all.afirstname.value!="")||(document.all.alastname.value!="")||((document.all.aphone.value!="")&&(document.all.aphone.value!="###-###-####"))||((document.all.aemail.value!="")&&(document.all.aemail.value!="[redacted email domain]")&&(document.all.aemail.value!="firstname.lastname[redacted email domain]")&&(document.all.aemail.value!="[redacted email]"))||(document.all.asector.value!="")||(document.all.aposition.value!="")||(document.all.agroup.value!="")||(CheckRadioList("alanguage"))||(document.all.aaddress.value!="")||(document.all.adirector.value!="")))

From stevefulton on this Cracked article

All these are reason why, I believe, the "prequels" were not the actual stories, but propaganda stories created by Palpatine and his minions to make the Jedi look terrible and worthless. Midiclorians were created so that the rest of the people in the universe would not try to become Jedi, as they would "measure" their "Midiclorian level" and find that it was low or non-existent...because they don't exist. The Jedi in the stories and bumbling fools who can't see what is right in front of them. At the same time, they make Palapatine look like the smartest, most powerful in the universe. Who would ever want to mess with him? The "real" stories of the Clone Wars, etc. are yet to be told, and I'm pretty sure we will see them surface as a new trilogy very soon.

@SomeKittens
SomeKittens / tmp.html
Last active August 29, 2015 14:23
Batarang repro
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>asdf</title>
</head>
<body ng-controller="asdf as A">
{{ A.text }}
<button ng-click="A.button();">A button!</button>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script type="text/javascript">
@SomeKittens
SomeKittens / aResults.md
Last active September 18, 2015 20:48
JavaScript Array.prototype vs for loops
[randallkoutnik:~/Dropbox/node/perf]$ node index.js
--- .forEach ---
.forEach took 26.271 ms
for loop took 2.369 ms
--- filter ---
.filter took 6.790 ms
for loop took 4.008 ms
#!/bin/zsh
# Noodling around with window auto-setup
# http://movingtofreedom.org/2010/08/10/arranging-windows-from-the-gnulinux-command-line-with-wmctrl/
left_monitor="0"
middle_monitor="1300"
right_monitor="3201"
get_window_id() {
return $(wmctrl -l | grep "$1" | tail -1 | cut -f1 -d" ")

Angular Buddies FOSS Bash!

(pssst - not a member of Angular Buddies yet? Join here!. You're looking for the #bash channel.)

Welcome to the first FOSS Bash! This is an experiment - everything's subject to change, feedback welcome.

The goal of the FOSS Bash is like an Amish barn rasing - lots of smart folks getting together to accomplish a great thing in a day. Today's target is UI Layout. My goal is to halve the number of issues, down to 13, and zero open PRs.

How you can help