This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
export function useCounter(initial = 0) { | |
const [count, setCount] = useState(initial); | |
return [count, () => setCount(count + 1)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import {TextInput, TouchableWithoutFeedback, StyleSheet} from 'react-native'; | |
const Platform = require('Platform'); | |
const requireNativeComponent = require('requireNativeComponent'); | |
const emptyFunction = require('fbjs/lib/emptyFunction'); | |
if (Platform.OS === 'android') { | |
var AndroidTextInput = requireNativeComponent('AndroidTextInput', null); | |
} else if (Platform.OS === 'ios') { | |
var RCTTextView = requireNativeComponent('RCTTextView', null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this._panResponder = PanResponder.create({ | |
// ----------- NEGOTIATION: | |
// A view can become the touch responder by implementing the correct negotiation methods. | |
// Should child views be prevented from becoming responder on first touch? | |
onStartShouldSetPanResponderCapture: (evt, gestureState) => () => { | |
console.info('onStartShouldSetPanResponderCapture'); | |
return true; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This is a basic deploy script for Heroku apps. | |
# It provides a structure you can use to expand on | |
# and add your own prereqs and deploy tasks. | |
# | |
# It basically ensures that: | |
# 1. There are no uncommited files | |
# 2. You can ssh to github | |
# 3. You can connect to heroku |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: node app.js | |
worker: node consumer.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "ruby-growl" | |
watch ('project/(.*).py') {|md| code_changed "#{md[0]}"} | |
def code_changed(file) | |
# Get the path of the file that changed | |
dir = File.dirname(file) | |
test(dir) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Based on https://gist.github.com/583836 from http://stackoverflow.com/questions/3709391/node-js-base64-encode-a-downloaded-image-for-use-in-data-uri. | |
* Neither that gist nor this one work for me in 0.2.x or 0.3.x. | |
*/ | |
var request = require('request'), | |
BufferList = require('bufferlist').BufferList, | |
sys = require('sys'), | |
bl = new BufferList(), | |
url = 'http://nodejs.org/logo.png' | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function() { | |
var doc = document, | |
htm = doc.documentElement, | |
lct = null, // last click target | |
nearest = function(elm, tag) { | |
while (elm && elm.nodeName != tag) { | |
elm = elm.parentNode; | |
} | |
return elm; | |
}; |
NewerOlder