Skip to content

Instantly share code, notes, and snippets.

View fmsf's full-sized avatar

fmsf

  • ex-Palantir, x-ebay, x-startups
View GitHub Profile
// @fmsf303 <-- will send the gist later
// Cool stuff:
// Youtube: -> The Role of a Forward Deployed Software Engineer
// function sum(a, b) {
// return a + b;
// }
const sum = (a, b) => a + b;
const not = (v) => !v;
const sum = (a, b) => a + b;
const not = (value) => !value;
const isEven = (number) => number % 2 == 0;
console.log("sum(4, 2) == " + sum(4,2));
console.log("not(true) == " + not(true));
@fmsf
fmsf / dead-center.less
Created September 12, 2013 10:13
Relative css dead center in less
.relative-dead-center {
position: absolute;
top: 50%;
margin-left: 50%;
> * {
margin-top: -50%;
margin-left: -50%;
}
}
@fmsf
fmsf / gist:6172511
Created August 7, 2013 09:18
TMUX cheats
[10:12:54] Francisco Ferreira: http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course
[10:15:53] Andrzej Grzesik: set -g utf8 on
set -g status-utf8 on
set -g default-terminal "screen-256color"
setw -g automatic-rename
setw -g mode-mouse on
set -g mouse-select-pane on
set -g history-limit 30000
@fmsf
fmsf / gist:4539675
Created January 15, 2013 15:59
git rebased merge
Let's say I have a branch "my-feature" (which only exists locally on my PC!) that I want to merge now into "master":
- Make sure that my master branch is at the most recent version (i.e. fetch/pull master branch)
- Rebase branch "my-feature" on "master" (resolving conflicts where necessary)
- Switch to "master" branch (checkout)
- Merge the rebased "my-feature" branch into master, with option "--no-ff" (i.e. "git merge --no-ff my-feature")
@fmsf
fmsf / gist:4344860
Created December 20, 2012 11:48
Must remember to push this to flot
// draw ticks
for (i = 0; i < axis.ticks.length; ++i) {
ctx.beginPath();
var v = axis.ticks[i].v;
xoff = yoff = 0;
if (v < axis.min || v > axis.max
// skip those lying on the axes if we got a border
@fmsf
fmsf / jquery update plugin
Last active December 9, 2015 22:58
Mini jquery plugin to update a stored jQuery object based on the original selector string. It will effectively replace all previous dom nodes with the ones matched when the update function is called;
(function ( $ ) {
$.fn.update = function(){
var newElements = $(this.selector),i;
for(i=0;i<newElements.length;i++){
this[i] = newElements[i];
}
for(;i<this.length;i++){
this[i] = undefined;
}
this.length = newElements.length;