Skip to content

Instantly share code, notes, and snippets.

View timsuchanek's full-sized avatar
🐋

Tim Suchanek timsuchanek

🐋
View GitHub Profile
@timsuchanek
timsuchanek / drifting.js
Last active December 17, 2015 17:09
Simple Drifting, used in several tests written in CasperJS for the https://github.com/azoff/Overscroll jQuery Plugin. Can be used in Node.JS and in the browser.
/**
* A wrapper function to make easy drifts.
* Works as a nodejs or browser module.
* @author vardump
* @param {object} options {
startCoordinates: { //optional
x: Number,
y: Number
},
degree: Number, // degree of direction to drift.
@timsuchanek
timsuchanek / Concat minify
Last active August 29, 2015 14:08
No need for grunt
# concat & minify
# you can use cat file1 file2 file3, too
cat *.js | uglifyjs -m -c > min.js
# concat & minify & get gzipped size
cat *.js | uglifyjs -m -c | gzip | wc -c
### Keybase proof
I hereby claim:
* I am timsuchanek on github.
* I am timsuchanek (https://keybase.io/timsuchanek) on keybase.
* I have a public key whose fingerprint is 9B57 3E9F 0B96 E5D4 D9BC 06D3 B954 8557 6510 71A5
To claim this, I am signing this object:
> node-pre-gyp install --fallback-to-build
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: 404 status code downloading tarball
gyp ERR! stack at Request.<anonymous> (/home/pi/serverless-webrtc/node_modules/wrtc/node_modules/node-gyp/lib/install.js:246:14)
gyp ERR! stack at emitOne (events.js:82:20)
gyp ERR! stack at Request.emit (events.js:166:7)
gyp ERR! stack at Request.onRequestResponse (/home/pi/serverless-webrtc/node_modules/wrtc/node_modules/node-gyp/node_modules/request/request.js:1156:10)
gyp ERR! stack at emitOne (events.js:77:13)
@timsuchanek
timsuchanek / npm-debug.log
Created April 21, 2015 14:34
npm-debug.log
This file has been truncated, but you can view the full file.
2001 silly cache add parsed spec { raw: 'nan@~1.7.0',
2001 silly cache add scope: null,
2001 silly cache add name: 'nan',
2001 silly cache add rawSpec: '~1.7.0',
2001 silly cache add spec: '>=1.7.0 <1.8.0',
2001 silly cache add type: 'range' }
2002 silly addNamed nan@>=1.7.0 <1.8.0
2003 verbose addNamed ">=1.7.0 <1.8.0" is a valid semver range for nan
2004 silly addNameRange { name: 'nan', range: '>=1.7.0 <1.8.0', hasData: false }
2005 silly mapToRegistry name nan
@timsuchanek
timsuchanek / copy-to-subdir.sh
Created January 20, 2016 18:07
copying files to subfolders with fish shell
#!/bin/fish
set modes landscape portrait
for file in (ls -d */)
for mode in $modes
for i in (seq 4)
cp lines.x-template.js {$file}lines.{$mode}.{$i}.js
end
end
end
@timsuchanek
timsuchanek / regex.vim
Created January 21, 2016 19:46
vim regex for converting from js prop syntax to Immutable.js syntax
# converting
# lines[1][2] = 'asd'
# to
# .setIn([1,2], 'asd')
# mark the lines with V, then type :
# the following will appear:
# :'<,'>
# continue with
@timsuchanek
timsuchanek / ExcludeProps.jsx
Created October 25, 2016 13:54
Sometimes you have unwanted props in a child, especially when {...props} is used. This Wrapper Component filters them.
function ExcludeProps(Component: any, filter: string[] = []) {
return (props) => {
const keys = Object.keys(props).filter(key => !filter.includes(key))
const picked = lodash.pick(props, keys)
return <Component {...picked} />
}
}
@timsuchanek
timsuchanek / observe.js
Last active March 2, 2017 22:23
Observe Subscriptions
import { Observable } from 'rxjs/Observable'
import { SubscriptionClient } from 'subscriptions-transport-ws'
const ws = new SubscriptionClient("endpointurl")
const observable = Observable.create(observer => {
const id = this.ws.subscribe(graphQLParams, (err, res) => {
if (err) {
observer.next(res)
observer.unsubscribe()
}
@timsuchanek
timsuchanek / CHANGELOG.md
Last active September 11, 2017 19:55
graphcool cli 1.3.13

Changes

  • hello world as blank project
  • removed debug .json files
  • proper formatted graphcool.yml of blank project
  • proper printing of init command
  • proper printing of add command
  • better usage command (graphcool help)
  • rename schemaExention to resolver
  • function logs
  • get-root-token