Skip to content

Instantly share code, notes, and snippets.

@katylava
katylava / git-selective-merge.md
Last active February 27, 2024 10:18
git selective merge

Update 2022: git checkout -p <other-branch> is basically a shortcut for all this.

FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

@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;
};
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}"
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active July 24, 2024 15:28
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
@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

$('.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()
}
});
@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>
@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';

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).

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