Skip to content

Instantly share code, notes, and snippets.

Errmojis

Users have a hard time dealing with errors.

To solve that, put these emojis prominently in your error messages. Then when the user says:

I dont know what happened but I saw a christmas tree and then everything stopped working

You'll know it was an internal error!

@prestonp
prestonp / gist:ad5d1a3f9a026e34c44c
Last active May 13, 2024 11:40
mov to webm osx

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@jrf0110
jrf0110 / config.js
Last active December 22, 2015 22:59
Boilerplate node.js app configuration
var utils = require('./lib/utils');
var config = {};
/**
* Change configuration environment
* @param {String} env The environment to change to
*/
var changeEnvironment = function(env){
if (env == null || !config.hasOwnProperty(env)) env = 'dev';
@jrf0110
jrf0110 / markup.html
Created August 20, 2013 15:34
Cross Browser Flex Columns
<div class="columns flex-columns">
<div class="col col-fixed">Hi</div>
<div class="col col-flex">Mom</div>
</div>
$('.username').map(function() {
var d = $(this).siblings('img').data();
if(d && /[0-9_]/.test($(this).text())) {
$.post('/i/user/block', {authenticity_token:'<PUT YOURS HERE>', user_id:d.userId});
return $(this).text()
}
});
@pfrazee
pfrazee / gist:4945450
Last active December 13, 2015 17:08
Non-performant JS Patterns

It pains me to write this, because I prefer the more robust, function-composition-focused features of Javascript, but there's a threshold of performance where speed overrides elegance. After all, performance is half the reason that programming is skilled labor. So here we have it-- my list of performance benchmarks and advice.

The Unusable

Try / Catch -- Use conditionals instead

Try/Catch Performance may be pitting try/catch against an easy-to-optimize opponent, but it still makes a strong case.

Function Bind -- Use closure variables instead

@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 14, 2024 18:00
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
for i in $HOME/local/*; do
[ -d $i/bin ] && PATH="${i}/bin:${PATH}"
[ -d $i/sbin ] && PATH="${i}/sbin:${PATH}"
[ -d $i/include ] && CPATH="${i}/include:${CPATH}"
[ -d $i/lib ] && LD_LIBRARY_PATH="${i}/lib:${LD_LIBRARY_PATH}"
[ -d $i/lib ] && LD_RUN_PATH="${i}/lib:${LD_RUN_PATH}"
# uncomment the following if you use macintosh
# [ -d $i/lib ] && DYLD_LIBRARY_PATH="${i}/lib:${DYLD_LIBRARY_PATH}"
[ -d $i/lib/pkgconfig ] && PKG_CONFIG_PATH="${i}/lib/pkgconfig:${PKG_CONFIG_PATH}"
[ -d $i/share/man ] && MANPATH="${i}/share/man:${MANPATH}"
@jrf0110
jrf0110 / class.js
Created April 23, 2012 22:05
Simple extendable classes in javascript
/* This WAS a two-line function until an awesome reddit user pointed out my logical flaw. Now It's a 5-line function :( */
var Class = function(d){
d.constructor.extend = function(def){
for (var k in d) if (!def.hasOwnProperty(k)) def[k] = d[k];
return Class(def);
};
return (d.constructor.prototype = d).constructor;
};