Skip to content

Instantly share code, notes, and snippets.

@dbasedow
dbasedow / KeyboardHandler.js
Created May 28, 2016 09:11
Keyboard spacing solution for react-native based on the stackoverflow answer http://stackoverflow.com/a/33585501/1783214
/**
* Based on http://stackoverflow.com/a/33585501/1783214
*
* Handle resizing enclosed View and scrolling to input
* Usage:
* <KeyboardHandler ref='kh' offset={50}>
* <View>
* ...
* <TextInput ref='username'
* onFocus={()=>this.refs.kh.inputFocused(this,'username')}/>

I would like to propose a lightning talk for the Reactive Conference demonstrating how you can interact with Arduino and/or Raspberry Pi GPIO's using React Native.

Here's is an example video where fellow speaker Brent Vatne controls my arduino device remotely using a sample react native app that can be found here

Thank you, @christopherdro

@adamico
adamico / collection_check_boxes_input.rb
Last active April 28, 2020 15:12 — forked from mattclar/simple_form.rb
This fork adds a custom horizontal form wrapper and merges append/prepend in a 'group' wrapper
#app/inputs/collection_check_boxes_input.rb
class CollectionCheckBoxesInput < SimpleForm::Inputs::CollectionCheckBoxesInput
def item_wrapper_class
"checkbox-inline"
end
end
@juliocesar
juliocesar / for-loops.js
Created May 3, 2013 04:42
ES6 - for loops
// ES6 for loops
// =============
// Things in ES6 can be "iterable". Arrays are iterable by default.
var fruits = ['Apple', 'Banana', 'Grape'];
for (var fruit of fruits)
console.log('Fruit: ' + fruit);
@murdoch
murdoch / hspm.rb
Created October 24, 2011 00:35
has secure password memo
# some notes on using has_secure_password
class User < ActiveRecord::Base
has_secure_password
attr_accessible :login_name, :password, :password_confirmation
# secure_password.rb already checks for presence of :password_digest
# so we can assume that a password is present if that validation passes
# and thus, we don't need to explicitly check for presence of password