Skip to content

Instantly share code, notes, and snippets.

@garrettmac
garrettmac / cheatsheet.md
Created February 7, 2017 19:03
terminal commands

Terminal

remove file rm -rf [folder] find mdfind -onlyin [file]

alias Create an alias •

/*
https://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2015%2Ces2016%2Creact%2Cstage-2&targets=&browsers=&builtIns=false&code=const%20cat%20%3D%20%7B%0A%20%20name%3A%20'Luna'%2C%0A%20%20friends%3A%20%7Bbest%3A%20'Ellie'%7D%2C%0A%20%20legs%3A%204%2C%0A%7D%0Aconst%20strangeCat%20%3D%20%7B...cat%2C%20legs%3A%206%7D%0A%0Aconst%20sameCat%20%3D%20%7B...cat%7D%0Aconsole.log(cat.friends%20%3D%3D%3D%20sameCat.friends)%20%2F%2F%20true%0AsameCat.friends.best%20%3D%20'Buddy'%0Aconsole.log(cat.friends.best)%20%2F%2F%20Buddy%0Aconsole.log(strangeCat)
http://www.reactnativeexpress.com/object_spread
*/
const cat = {
name: 'Luna',
friends: {best: 'Ellie'},
legs: 4,
@garrettmac
garrettmac / react-native-popover.md
Created May 11, 2017 00:12
react native plugins config
import Popover from 'react-native-popover';
this._closePopover = this._closePopover.bind(this)

in constructor

@garrettmac
garrettmac / 2016-election-results.md
Last active June 15, 2017 14:33
2016 Election Results - Blue States Trump Won

Election Results

Trump Won 3 Blue States

He gave speeches in these three Blue states that Red candidates don't ever even bother with. Resulting in his win.

Michigan Pennsylvania Wisconsin
Blue State Since 1984 1988 1934
Years Blue 32 years 28 years 36 years
@garrettmac
garrettmac / index.html
Created May 20, 2017 15:57
thumbtack.com
<!DOCTYPE html>
<!--[if IE 7 ]> <html lang="en" class="ie7 "> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="ie8 "> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class=""> <!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"><meta http-equiv="Content-Style-Type" content="text/css" /><meta http-equiv="Content-Script-Type" content="text/javascript" /><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name=dropbox-domain-verification content=0gjo970nvgw9 /><title>Thumbtack - Consider it done</title><meta property="fb:app_id" content="131357050011"><meta
property="og:url"
@garrettmac
garrettmac / animation-panresponder.md
Last active August 16, 2017 17:35
Blog Posts for React Native - Post 1:Native ModulesPost 2: Pan Responder (Animation)

Lets start with boiler template

/* @flow */

import React, { Component } from 'react';
import {
  View,
  TouchableOpacity,
  Text,
@garrettmac
garrettmac / pulse.css
Last active May 24, 2017 21:12
pulse.css
.pulse {display: block;box-shadow: 0 0 0 rgba(204,169,44, 0.4);animation: pulse 2s infinite;}
.pulse:hover {animation: none;}
@-webkit-keyframes pulse {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
}
70% {
-webkit-box-shadow: 0 0 0 10px rgba(204,169,44, 0);
@garrettmac
garrettmac / example.js
Last active January 14, 2022 19:11
react native congressmen floating bubble heads example
import React, { Component } from 'react';
import { StyleSheet, View,Text, Image, Animated, Dimensions } from 'react-native';
import Interactable from 'react-native-interactable';
const widthFactor = Dimensions.get('window').width / 375;
const heightFactor = (Dimensions.get('window').height - 75) / 667;
const showSecondFace = true;
const showThirdFace = true;
const showFourthFace = true;
@garrettmac
garrettmac / index.js
Last active June 18, 2017 23:14
RN ListView - hide first and last in list
state={
endsOfArray:{first:0,last:4,},
numberOfVisableItems:4,
array:[{"id":0,"opacity":1,"name":"Jobe Holly"},{"id":1,"opacity":1,"name":"Bernie Sanders"},{"id":2,"opacity":1,"name":"Al Frankin"},{"id":3,"opacity":1,"name":"Elizabeth Warren"},{"id":4,"opacity":1,"name":"Cory Booker"},{"id":5,"opacity":1,"name":"Sanders"},{"id":6,"opacity":1,"name":"Al"},{"id":7,"opacity":1,"name":"Elizabeth"},{"id":8,"opacity":1,"name":"Booker"}],
}
_onChangeVisibleRows(visibleRows, changedRows) {
let visableItems=_.map(visibleRows.s1, function(active, id) {return { id: id, active: active };})
// console.warn(" visableItems.length: ",visableItems.length);