Skip to content

Instantly share code, notes, and snippets.

@bmatcuk
bmatcuk / create-usb.sh
Created May 30, 2019 04:38
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@geoffmiller
geoffmiller / mobx-recompose.jsx
Last active December 11, 2018 22:20
Mobx with Recompose structure
const { compose, mapProps, withHandlers, lifecycle } = Recompose;
const { observable, action } = mobx;
const { inject, observer, Provider } = mobxReact;
const { PropTypes } = React;
// store
// ============================
const counterStore = observable({
// for primitive values, wrap the value inside a observable,
// or wrap it in an plain js object
/**
* HighlightableImage.js
*
* If we simply change the source prop of an Image in the render method, the
* image blinks, and there is no image for a fraction of a second. This is
* solved by mounting 2 images and changing their opacity.
*
*/
import React from 'react'
import {
@Jpoliachik
Jpoliachik / index.ios.js
Last active August 17, 2021 10:27
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@anvaka
anvaka / 00.Intro.md
Last active March 7, 2024 13:07
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@gaearon
gaearon / slim-redux.js
Last active April 25, 2024 18:19
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active January 16, 2024 21:15
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@chantastic
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@ifaour
ifaour / MyCustomActivity.java
Last active September 16, 2016 03:31
Example custom parse push receiver
package com.parse.starter;
import android.app.Activity;
import android.os.Bundle;
import com.parse.ParseAnalytics;
public class MyCustomActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@jpotts18
jpotts18 / Alamofire-JSON-Serialization.md
Last active August 17, 2020 15:44
Alamofire JSON Serialization of Objects, Collections, Nesting

Alamofire JSON Serialization of Objects and Collections

Alamofire is a great Swift library developed by the creator of AFNetworking @mattt. The purpose of this gist is to explain how to use the built-in power of Alamofire to serialize your JSON. In this example we will be serializing a simple blog API. First we will start with serializing a single JSON object and add complexity as we go along.

Warning: This was written before Swift 1.2

A Single JSON Serialization

This is the first JSON object that we will be serializing.