Skip to content

Instantly share code, notes, and snippets.

View verticalgrain's full-sized avatar

Jamie Graham verticalgrain

View GitHub Profile
@verticalgrain
verticalgrain / react-native-cheat-sheet.js
Last active March 24, 2018 20:34
React Native Cheat Sheet
// To accept Android SDK licenses:
~/Library/Android/sdk/tools/bin/sdkmanager --licenses
// If getting error could not resolve all dependencies for configuration ':app:debugAPKCopy'
// Need to add android support libraries through maven
https://stackoverflow.com/a/46014816/2196202
https://github.com/invertase/react-native-firebase/issues/381#issuecomment-326561669
@verticalgrain
verticalgrain / cheatsheet.txt
Created March 18, 2018 04:23
React native cheet sheet
// Build iOS app
react-native run-ios
@verticalgrain
verticalgrain / scrollEvents.js
Last active June 19, 2019 10:21
Simple throttled scroll event using standalone lodash throttle / debounce function
( function( $, window, undefined ) {
'use strict';
// Cache elements
var $stickyTabbar = $( '.tabbar__bar' ),
$stickyTabbarParent = $( '.tabbar' ),
stickyTabbarClass = 'is-fixed';
var stickyTabbarToggle = function(e) {
@verticalgrain
verticalgrain / raspberry-pi-cheatsheet.txt
Last active May 17, 2018 19:44
Raspberry Pi Cheatsheet
// ssh
ssh pi@raspberrypi.local
// Make raspberry pi ssh over usb:
// Insert flash drive to my mac
// Add the following to the end of /config.txt:
# Make usb act like ethernet
dtoverlay=dwc2
# Ensure HDMI will work
hdmi_force_hotplug=1
@verticalgrain
verticalgrain / nix-cheat-sheet.txt
Last active July 23, 2018 15:53
*Nix Cheat Sheet
// Make something executable
sudo chmod +x /etc/rc.local
// Run several commands as root
sudo sh -c "echo 21 >/sys/class/gpio/export"
// List all groups
getent group
// List all users
@verticalgrain
verticalgrain / Flexbox Cheatsheet.txt
Created October 16, 2017 16:29
Flexbox cheatsheet
// Fix misalignment of last item in a flexbox grid:
https://codepen.io/verticalgrain/pen/BwGoJX
@verticalgrain
verticalgrain / npm-cheat-sheet.txt
Last active November 11, 2017 22:07
NPM Cheat Sheet
// List all packages
npm list
// List specific package
npm list grunt
// Update a package
npm update grunt
// Update to a specific version (older or newer)
@verticalgrain
verticalgrain / amp.php
Created September 8, 2017 16:55
AMP inline styles
/**
* Add additional styles for our AMP template. AMP requires inline styles.
*/
public static function amp_additional_css_styles() {
global $post;
$css = str_replace( 'STYLESHEET_DIRECTORY', get_stylesheet_directory_uri(), wpcom_vip_file_get_contents( get_stylesheet_directory_uri() . '/assets/css/amp.min.css', 3, 60 ) );
echo ESPN_AMP::sanitize_meta_css( $css );
}
@verticalgrain
verticalgrain / jetpack-cheatsheet.txt
Created August 25, 2017 21:47
Jetpack Cheat Sheet
// Enable extra jetpack widgets:
wp-admin/admin.php?page=jetpack_modules
@verticalgrain
verticalgrain / style-directory.txt
Last active September 25, 2017 18:09
Style directory structure
styles
/includes
_base.scss
_fonts.scss
_functions.scss
_grid.scss
_mixins.scss
_normalize.scss
_typography-global.scss
_variables.scss