Skip to content

Instantly share code, notes, and snippets.

View deanmcpherson's full-sized avatar

Dean McPherson deanmcpherson

View GitHub Profile
@deanmcpherson
deanmcpherson / SortableListView.js
Last active February 1, 2016 05:50
React native drag and drop list view in progress
var React = require('react-native');
var {
ListView,
LayoutAnimation,
View,
Animated,
PanResponder,
TouchableWithoutFeedback
} = React;
<ScrollView horizontal={true} snapToInterval={200} snapToAlignment="center">
<View style={{width: 200}}>
<Text>Option 1</Text>
</View>
<View style={{width: 200}}>
<Text>Option 2</Text>
</View>
<View style={{width: 200}}>
<Text>Option 3</Text>
</View>
@deanmcpherson
deanmcpherson / S3Upload.js
Created May 7, 2016 01:10
Upload image to S3, generates unique name
var FileTransfer = require('@remobile/react-native-file-transfer');
var s3Conf = {
key: 'KEY',
bucket: 'BUCKET_NAME',
aws_url: 'https://BUCKET_NAME.REGION.amazonaws.com'
}
var guid = (function() {
function s4() {
@deanmcpherson
deanmcpherson / alignment.css
Created June 16, 2016 07:54
Text alignment -> draftjs workaround
.alignment--left {
.public-DraftStyleDefault-block {
text-align; left;
}
}
.alignment--center {
.public-DraftStyleDefault-block {
text-align; center;
}
}
@deanmcpherson
deanmcpherson / persistedExample.js
Created July 12, 2016 23:21
Example of sortable that persists over logins.
let SortableListView = require('./SortableListView');
let React = require('react-native');
let {
View,
Text,
TouchableHighlight,
AsyncStorage
} = React;
const DATA = 'DATA';
### Keybase proof
I hereby claim:
* I am deanmcpherson on github.
* I am deanmcpherson (https://keybase.io/deanmcpherson) on keybase.
* I have a public key ASC-7OMzcq3931gdZcut7OQgKpuZ08NarLmqQJMlrfCF4wo
To claim this, I am signing this object:
@deanmcpherson
deanmcpherson / super.js
Last active February 12, 2024 20:12
super quick and dirty code embed support
//<script>
function clearBlock(el) {
const node = el.parentElement.parentElement;
node.innerHTML = '';
return node;
}
const SELECTOR = 'code:not([super-embed-seen])';
function setupEmbeds() {