Skip to content

Instantly share code, notes, and snippets.

View SomeKittens's full-sized avatar

Randall Koutnik SomeKittens

View GitHub Profile
@SomeKittens
SomeKittens / login.js
Created October 25, 2013 20:19
Zombie.js login to StackOverflow
var Browser = require('zombie');
var url = 'http://stackoverflow.com/users/login?returnurl=http%3a%2f%2fchat.stackoverflow.com%2frooms%2f17%2fjavascript';
//url = 'http://chat.stackoverflow.com/rooms/17/javascript';
browser = new Browser({maxWait: 500});
//console.log(browser.cookies);
//browser.cookies(url).set('session', '123');
browser.visit(url, function(e) {
if (e) return console.error(e);
//console.log(browser);
@SomeKittens
SomeKittens / cookies.js
Created October 25, 2013 22:53
Logs in and dumps cookies
var Browser = require('zombie');
var url = 'http://stackoverflow.com/users/login?returnurl=http%3a%2f%2fchat.stackoverflow.com%2frooms%2f17%2fjavascript';
browser = new Browser();
browser.visit(url, function(e) {
browser.wait(function(window) {
return window.document.querySelector('#openid_highlight');
}, function() {
@SomeKittens
SomeKittens / lintMe.js
Created November 4, 2013 18:36
Linter Alert
function() {
var myVariable = 'test 123';
console.log(myVaraible); // Uh oh! There's a typo here.
// JSLint tells us `'myVaraible' was used before it was defined`, catching the error before it's run
};
@SomeKittens
SomeKittens / elastic.sh
Created January 9, 2014 19:11
ElasticSearch script install
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.9.zip
unzip elasticsearch-0.90.9.zip -d /usr/local/elasticsearch
cd /usr/local/elasticsearch/elasticsearch-0.90.9
bin/plugin -install elasticsearch/elasticsearch-cloud-aws/1.16.0
bin/plugin -install mobz/elasticsearch-head
mv * /usr/local/elasticsearch/
cd ..
rm -R elasticsearch-0.90.9
cd config
echo '' >> elasticsearch.yml
@SomeKittens
SomeKittens / swift required
Created March 4, 2014 18:36
Sendgrid upgraded everything and made it hard to find the old docs.
ln -s swiftmailer/lib/swift_required.php swift_required.php
@SomeKittens
SomeKittens / gist:9579594
Last active August 29, 2015 13:57
Converting commands
@SomeKittens
SomeKittens / app.js
Last active August 29, 2015 13:57
Passport auth example
// assuming you're using express
'use strict';
//express stuffs
var passport = require('passport');
var user = require('./user');
// Configs the passports
require('./passportConfig');
@SomeKittens
SomeKittens / keybase.md
Created March 28, 2014 19:03
keybase.md

Keybase proof

I hereby claim:

  • I am somekittens on github.
  • I am rkoutnik (https://keybase.io/rkoutnik) on keybase.
  • I have a public key whose fingerprint is 0E84 45F0 6104 96C0 F62A 1055 6943 A18A 7088 C932

To claim this, I am signing this object:

'use strict';
var pg = require('pg')
, bluebird = require('bluebird')
, connString = require('./config').pg;
bluebird.promisifyAll(pg);
bluebird.promisifyAll(pg.Client.prototype);
module.exports = function() {

Don't start a hosting company

I talk to a lot of people who are just starting their first startup. An oddly large percentage of them want to know what it'll take to start a webhosting company. This isn't surprising, as web hosting companies like GoDaddy are very visible. Almost everyone needs some sort of hosting to get started. The technical challenges don't seem overwhelming to the beginner - chances are, they've played with some sort of server already. Most importantly, hosting services seem to make a lot of money. To the uninitiated, this seems like a great area to enter. In this essay, I hope to explain why you shouldn't start a hosting service, while also explaining more general pitfalls beginners encounter.

#It's never about the money Lots of beginners fall for the 1% fallacy (the idea that all they need to succeed is 1% of the market) when selecting what to build. They see large, entrenched players as a good sign - there's money to be made here. Large companies are particularly keen on no