Skip to content

Instantly share code, notes, and snippets.

View parshap's full-sized avatar

Parsha Pourkhomami parshap

View GitHub Profile
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 / 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,
@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 / 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 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 / -
Created February 17, 2015 19:41
Warning: distutils distribution has been initialized, it may be too late to add a library RWarning: distutils distribution has been initialized, it may be too late to add a library blasWarning: distutils distribution has been initialized, it may be too late to add an extension _earthTraceback (most recent call last):
File "setup.py", line 62, in <module>
'lifeline-admin=lifeline.admin.main:LifelineAdmin.main'
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/src/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 27, in run
requiresafe@1.2.0 /usr/lib/node_modules/requiresafe
├── tryit@1.0.1
├── find-root@0.1.1
├── is-email@0.1.1
├── amp-is-object@1.0.1
├── amp-extend@1.0.1
├── minimist@1.1.0
├── marked@0.3.3
├── yetify@0.1.0 (colors@1.0.3)
├── chalk@0.5.1 (escape-string-regexp@1.0.2, ansi-styles@1.1.0, supports-color@0.2.0, has-ansi@0.1.0, strip-ansi@0.3.0)
@parshap
parshap / css-in-js.md
Last active August 29, 2015 14:16
CSS in JavaScript

CSS in JavaScript

Expressing styles in JavaScript isn't all that different than expressing them in css.

Plain Ol' HTML & CSS

Imagine you had the following css and html:

Styles
"use strict";
// # Responsive Component
//
// A react component that will conditionally render children that correspond
// to the currently matching "named" media query.
//
// The predefined named media queries are: "small", "not-small", "medium", and
// "large". These correspond to CSS classes that end with "-ns", "-m", etc.
// suffixes.
@parshap
parshap / mylogger
Last active August 29, 2015 14:27
Log to file and handle SIGHUP
#!/bin/bash
logfile=$1
pidfile=$2
sighup() {
exec 0>>$logfile 2>&1
}
echo "$$" > $pidfile