Skip to content

Instantly share code, notes, and snippets.

View jumichot's full-sized avatar
🏠
Working from home

julien michot jumichot

🏠
Working from home
View GitHub Profile
@josevalim
josevalim / watcher.sh
Last active May 22, 2024 10:06
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | mix test --stale --listen-on-stdin
@paulirish
paulirish / what-forces-layout.md
Last active June 5, 2025 13:25
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
config :my_app, :twitter_api,
client: Twitter.SandboxClient
@pcreux
pcreux / mkspec.rb
Last active April 26, 2016 17:51
mkspec - Generate spec file (in vim: `:!mkspec %`)
#!/usr/bin/env ruby
DESC = "
Generate spec file
Example: mkspec app/services/user/create.rb will generate spec/services/user/create_spec.rb
"
@voter101
voter101 / Gulpfile.js
Last active October 16, 2024 17:37
Gulpfile for Rails application with replaced Sprockets with Gulp
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@Flink
Flink / gist:bb6cbf28871b9541ba6c
Last active July 17, 2018 18:57
Ruby DCI articles & related
http://rubyrogues.com/056-rr-david-heinemeier-hansson/
http://mikepackdev.com/blog_posts/24-the-right-way-to-code-dci-in-ruby
http://mikepackdev.com/blog_posts/37-dci-the-king-of-the-open-closed-principle
http://decomplecting.org/blog/2013/01/03/dci-the-right-idea-for-the-wrong-paradigm/
http://evan.tiggerpalace.com/articles/2011/11/24/dci-that-respects-the-method-cache/
http://tonyarcieri.com/dci-in-ruby-is-completely-broken
https://signalvnoise.com/posts/3372-put-chubby-models-on-a-diet-with-concerns
http://blog.codeclimate.com/blog/2012/12/19/dci-concerns-and-readable-code/
http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/
http://martinfowler.com/bliki/AnemicDomainModel.html
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active May 20, 2025 13:11
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@bejes
bejes / spancount.js
Created October 19, 2012 02:29
Simple jquery plugin to insert spans in text and a defined character limit
/**
* Plugin function to insert spans into text:
* usage
* $(document).ready(function() {
* $('p.charcount').charSpanCount(); });
* or $(document).ready(function() {
* $('p.charcount').charSpanCount({'charcount' : 15});
* });
*/
(function($) {