Skip to content

Instantly share code, notes, and snippets.

David Hellsing davidhellsing

Block or report user

Report or block davidhellsing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@davidhellsing
davidhellsing / gist:6d5d8fd1a62943e43a6a91f6982e63b8
Last active Feb 20, 2019
Simple, functional animation of values using React Native Easing
View gist:6d5d8fd1a62943e43a6a91f6982e63b8
import { Easing } from 'react-native'
/*
* Function that animates a value from 0 - 1
* Uses React Native’s Easing functions
* Returns an object that has a stop() function
*/
interface Args {
duration: number,
View gist:6fbd8b82d14cec8482e9d9b427aae62c
<html>
<head>
<style>
#content{height: 8000px; width: 800px; margin: 0 auto; background: yellow;position: relative;}
</style>
</head>
<body>
<div id="content">
Lorem<br>
Lorem<br>
View gist:01ecaecd4245441a81280310f7e847bc
findKey = (haystack, needle) => {
let found = false
const iterate = (obj) => (
Object.keys(obj).forEach((key) => {
if (found === false) {
if (key === needle) {
found = key
} else if (obj[key] && typeof obj[key] === 'object') {
iterate(obj[key])
}
View gist:3e2e7bd78e09e208888122856cc9e211
var keys = [37, 38, 39, 40]
var prevent = (e) => {
if ( e.type != 'keydown' || keys.indexOf(e.keyCode) != -1 ) {
e.preventDefault()
return false
}
}
var disableScroll = (node) => {
node = node || window
node.onwheel = node.ontouchmove = document.onkeydown = prevent
View gist:b8a24b537750de4064cc
sudo ln -s /opt/X11 /usr/X11
View gist:e6eea9c6659ca9c23e7a
sudo mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/
@davidhellsing
davidhellsing / gist:f2c4842e3fea551a32ce
Last active Aug 29, 2015
Fix Brew for OSX Yosemite
View gist:f2c4842e3fea551a32ce
vi /usr/local/Library/brew.rb

Change line 1 from:

#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

to:

#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0

Save and exit

View gist:8d310b36a9825f318b13
// example:
// var stateHandler = State(node, function(state) { this.className = state.active ? 'active' : '' })
// stateHandler.set({ active: true })
var states = {}
function State(elem, render) {
if ( states.hasOwnProperty(elem) )
return states[elem]
if ( !(this instanceof State) ) {
var instance = new State(elem, render)
@davidhellsing
davidhellsing / gist:b7deb968e450f1d87d46
Created May 6, 2014
Deploy dist directory to gh-pages
View gist:b7deb968e450f1d87d46
#!/bin/bash
git add .
git commit -am 'master deploy'
git checkout gh-pages
git checkout master -- dist
rsync -a -v dist/ ./
rm -rf dist
git add .
git commit -am 'page deploy'
git push
You can’t perform that action at this time.