Skip to content

Instantly share code, notes, and snippets.

Meh, can't see me

Jean-Denis Vauguet chikamichi

Meh, can't see me
View GitHub Profile
chikamichi / model.rb
Last active Sep 26, 2016
Test: double example
View model.rb
class Model
# Let's say Elasticsearch needs a JSON representation of the model in order
# to index it. We delegate to a specialized class to generate that JSON:
def as_indexed_json
chikamichi / .tmux.conf
Last active Sep 6, 2021
Prevent highlighting text from scrolling down (exiting copy-mode) in tmux
View .tmux.conf
# Optional but convenient: use C-b v to paste the tmux buffer.
bind v paste-buffer
# Do not exit from copy-mode when selecting text.
# @see
# Note: the setting might be renamed MouseDragEndX.
# Depending on whether you activated tmux or vi keybindings (I'm using vi mode):
#bind -temaics-copy MouseDragEnd1Pane copy-selection -x
bind -tvi-copy MouseDragEnd1Pane copy-selection -x
chikamichi / base_job.rb
Last active Jun 6, 2016
Wrapper around DelayedJob (basic Job system for Rails)
View base_job.rb
require 'ostruct'
# Tiny wrapper around (custom) delayed jobs.
# @see
# @see
# Create a new job by inheriting from Base Job:
# # app/jobs/some_task_job.rb
# class SomeTask < BaseJob
chikamichi /
Last active Feb 11, 2020
About Lodash, how it works (forEach example)


About Lodash's forEach function, and Lodash in general…

I told you that it "abstracts away from you the chore (and complexity) of looping", so that you can focus on what really matters for your application: the collection you want to iterate through, and the piece of logic you wish to be applied for each item.

You use forEach like this:

// You first define "the collection you want to iterate through":
chikamichi / 01-using-a-node-and-a-list.elm
Created Jan 14, 2016
Elm - reworking the FIFO implementation from
View 01-using-a-node-and-a-list.elm
import Graphics.Element exposing (..)
import Text
type Fifo a
= Empty | Node a (List a)
empty : Fifo a
empty =
chikamichi /
Last active Nov 6, 2015
The web basics one must actually *know* about.
chikamichi / gist:5417680
Last active Dec 16, 2015
A fully-fledged CoffeeScript boilderplate for authoring jQuery plugin. It abides by the guidelines found at
View gist:5417680
FooBar jQuery Plugin v1.0 - It makes Foo as easy as coding Bar (?).
Release: 19/04/2013
Author: Joe Average <>
Licensed under the WTFPL license:
(($, window, document) ->
chikamichi / data.csv
Created Jun 29, 2012
d3: radial stack with nest
View data.csv
key axis value
min 1 2
avg 1 3.6
max 1 5
min 2 3
avg 2 8.2
max 2 10
min 3 0
avg 3 2.6
max 3 8
chikamichi / custom_specs.rake
Created Oct 12, 2011
How to add customs rspec tasks in Rails 3
View custom_specs.rake
# Our goal is to be able to run spec:bricks along spec, when
# using the 'rake spec' command.
# In lib/tasks/custom_specs.rake, add:
require 'rake/testtask'
require 'rspec/core/rake_task'
namespace :spec do
desc "Run bricks specs"'bricks') do |spec|
chikamichi / apotomo_builders.rb
Created Mar 19, 2011
Apotomo support for builders
View apotomo_builders.rb
# in lib/apotomo/widget.rb
# This comes redundant with Cells internals, but this is due to what may be a flaw in current Apotomo's design,
# which bypass Cells workflow (render_cell_for) and hook directly into AbstractController::Rendering #render_state
# Renders the +widget+ (instance or id).
def render_widget(widget_id, state=:display, *args)
if widget_id.kind_of?(Widget)
widget = widget_id
widget = find_widget(widget_id) or raise "Couldn't render non-existent widget `#{widget_id}`"