Skip to content

Instantly share code, notes, and snippets.

View parshap's full-sized avatar

Parsha Pourkhomami parshap

View GitHub Profile
@parshap
parshap / Dockerfile
Created February 9, 2015 18:40
Caching npm install with Docker
FROM nodesource/node:trusty
EXPOSE 8080
WORKDIR /src
# Install dependencies
# See http://www.clock.co.uk/blog/a-guide-on-how-to-cache-npm-install-with-docker
ADD package.json /src/package.json
RUN npm install
ADD . /src
@parshap
parshap / zuul-error.log
Last active August 29, 2015 14:14
Zuul error using localtunnel.me
➜ js-is-integer git:(test) ✗ time ./node_modules/.bin/zuul -- test.js
- testing: chrome @ Linux: 26 32 34
- testing: chrome @ Mac 10.8: 27 28 36 37 39
- testing: chrome @ Windows 2008: 29
- testing: chrome @ Windows 2003: 30
- testing: chrome @ Mac 10.6: 31 33 35
- testing: chrome @ Windows 2012: 38
- testing: firefox @ Windows 2003: 3.0 10 16 18
- testing: firefox @ Windows 2012: 3.5 4 5 6 9 12 22 24
- testing: firefox @ Windows 2012 R2: 3.6 11 14 17 27
@parshap
parshap / zuul-error.log
Created February 3, 2015 22:24
Zuul error using localtunnel.me
➜ js-is-integer git:(test) ✗ time ./node_modules/.bin/zuul -- test.js
- testing: chrome @ Linux: 26 32 34
- testing: chrome @ Mac 10.8: 27 28 36 37 39
- testing: chrome @ Windows 2008: 29
- testing: chrome @ Windows 2003: 30
- testing: chrome @ Mac 10.6: 31 33 35
- testing: chrome @ Windows 2012: 38
- testing: firefox @ Windows 2003: 3.0 10 16 18
- testing: firefox @ Windows 2012: 3.5 4 5 6 9 12 22 24
- testing: firefox @ Windows 2012 R2: 3.6 11 14 17 27
@parshap
parshap / zuul-error.log
Last active August 29, 2015 14:14
Zuul error using Sauce Connect
➜ js-is-integer git:(test) ✗ time ./node_modules/.bin/zuul --sauce-connect -- test.js
- testing: chrome @ Linux: 26 32 34
- testing: chrome @ Mac 10.8: 27 28 36 37 39
- testing: chrome @ Windows 2008: 29
- testing: chrome @ Windows 2003: 30
- testing: chrome @ Mac 10.6: 31 33 35
- testing: chrome @ Windows 2012: 38
- testing: firefox @ Windows 2003: 3.0 10 16 18
- testing: firefox @ Windows 2012: 3.5 4 5 6 9 12 22 24
- testing: firefox @ Windows 2012 R2: 3.6 11 14 17 27
@parshap
parshap / virtual-hyperscript-children.js
Last active August 29, 2015 14:13
virtual-hyperscript children as props.children
var h = require("virtual-hyperscript");
// Children as arguments[2]
h("div", {
"aria-hidden": true,
"ev-click": onClick,
}, [
h("p", {
"aria-hidden": true,
this.prevScrollTop = scroll.getScrollTop();
this.prevScrollLeft = scroll.getScrollLeft();
this.prevOverflow = window.document.body.style.overflow;
window.document.body.style.overflow = "hidden";
window.scrollTo(0, 0);
window.document.body.style.marginTop = px(-this.prevScrollTop);
window.document.body.style.marginLeft = px(-this.prevScrollLeft);
window.document.body.style.height = px(getWindowHeight() + this.prevScrollTop);
window.document.body.style.width = px(getWindowWidth() + this.prevScrollLeft);
@parshap
parshap / naming-tips.md
Created September 18, 2014 22:06
Naming Tips

Taken from Naming Tips.

  • Do not name methods ProcessData(). You only get to use this method name once per career, because you should have been fired immediately afterwards. Be specific about what it's doing inside; call it ValidateUserCredentials or EliminateDuplicateRequests or ComputeAverageAge, etc.

  • Use naming to help you design the program. Pretend there's a rule saying "you can never write a void function", then think about all the steps your program makes to transform input into output, then chose names for those steps so you could make a written sentence with them. These are now your function names and the sentence is your program's structure.

@parshap
parshap / remote-address-undefined.md
Created August 13, 2014 19:04
Node.js socket remoteAddress is undefined

Node socket remoteAddress is undefined

If the underlying socket is destroyed, a socket's remoteAddress is no longer accessible and undefined.

@parshap
parshap / install-vbox-guest-additions.sh
Created July 31, 2014 19:35
Install VirtualBox Guest Additions on a headless server
wget http://download.virtualbox.org/virtualbox/4.3.12/VBoxGuestAdditions_4.3.12.iso
sudo mkdir /media/iso
sudo mount -o loop ./VBoxGuestAdditions_4.3.12.iso /media/iso
sudo bash /media/iso/VBoxLinuxAdditions.run --nox11
sudo umount /media/iso
@parshap
parshap / mongoose-schema.js
Created July 24, 2014 21:22
Mongoose nested object unexpectd value
var mongoose = require("mongoose");
var schema = new mongoose.Schema({
nestedProp: {
bar: String,
baz: String,
},
});
var MyModel = mongoose.model("MyModel", schema);