Skip to content

Instantly share code, notes, and snippets.

@bbrown
bbrown / my.cnf
Created September 14, 2017 13:51
Local Mac OS X MySQL configuration, designed to get around "File Descriptor 2040 exceeded FD_SETSIZE=1024" errors
# Default Homebrew MySQL server config
[mysqld]
#interactive_timeout = 300
#wait_timeout = 300
max_allowed_packet=256M
table_open_cache=250
# Only allow connections from localhost
bind-address = *
#skip-networking
@newyankeecodeshop
newyankeecodeshop / ServingES6.md
Last active June 19, 2021 07:36
Serving ES6 to modern browsers

Background

Recently I noticed that Safari 10 for Mac/iOS had achieved 100% support for ES6. With that in mind, I began to look at the browser landscape and see how thorough the support in the other browsers. Also, how does that compare to Babel and its core-js runtime. According to an ES6 compatability table, Chrome, Firefox, and IE Edge have all surpassed what the Babel transpiler can generate in conjunction with runtime polyfills. The Babel/core-js combination achieves 71% support for ES6, which is quite a bit lower than the latest browsers provide.

It made me ask the question, "Do we need to run the babel es2015 preset anymore?", at least if our target audience is using Chrome, Firefox, or Safari.

It's clear that, for now, we can't create a site or application that only serves ES6. That will exclude users of Internet Explorer and various older browsers running on older iOS and Android devices. For example, Safari on iOS 9 has pretty mediocre ES6 support.

@gaearon
gaearon / reducers.js
Last active December 11, 2020 14:56
How I'd do code splitting in Redux (pseudo code, not tested!)
import { combineReducers } from 'redux';
import users from './reducers/users';
import posts from './reducers/posts';
export default function createReducer(asyncReducers) {
return combineReducers({
users,
posts,
...asyncReducers
});

Usage

  1. npm install babel-loader imports-loader webpack --save
  2. Create webpack.config.js
  3. Move index.ios.js to src/index.ios.jsx
  4. webpack --watch

Example

src/index.ios.jsx

@dawsontoth
dawsontoth / app.js
Created January 14, 2014 03:02
NodeJS server side simple JSON based socket communications. The Titanium client side counterpart to this is here: https://gist.github.com/dawsontoth/8412167
// We'll use cluster to split work across all of our CPUs.
var cluster = require('cluster');
// Are we the master process ...
if (cluster.isMaster) {
// Monitor the workers for failures.
cluster.on('exit', function(worker) {
console.log('Worker ' + worker.process.pid + ' died. Forking another...');
cluster.fork();
});
@dawsontoth
dawsontoth / app.js
Last active January 3, 2016 04:58
Titanium client side simple JSON based socket communications. The NodeJS server side component to this is available here: https://gist.github.com/dawsontoth/8412318
var lox = require('lib/lox');
lox.start();
lox.exampleOfSendWithoutCallback();
lox.exampleOfSendWithCallback(function(result) {
console.log('Got data back! ' + result);
});
@t-io
t-io / osx_install.sh
Last active October 22, 2023 13:04
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 2, 2024 03:13
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx