Skip to content

Instantly share code, notes, and snippets.

View rclavel's full-sized avatar

Romain Clavel rclavel

View GitHub Profile
@gaearon
gaearon / modern_js.md
Last active April 18, 2024 15:01
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@jasonnoble
jasonnoble / install_dash_gem_docs.rb
Last active December 26, 2021 03:42 — forked from spilth/install_dash_gem_docs.rb
Installs the Dash docs for all the Ruby Gems in your Gemfile
#!/usr/bin/env ruby
#
# Prerequisites:
# gem install bundler
# bundle install
dependencies = `bundle show | grep '*' | awk '{print $2, $3}' | sed -e 's/(//' -e 's/)//'`.split("\n")
dependencies.each do |dependency|
(gem_name, version) = dependency.split
#! /bin/bash
PREV_HEAD=$1
HEAD=$2
BRANCH_CHECKOUT=$3
# Skip the hook if the checkout is not a branch checkout.
[ "$BRANCH_CHECKOUT" = 1 ] || exit 0
# Tells wether a file has been modified between 'PREV_HEAD' and 'HEAD'.
@Norcoen
Norcoen / gitlab_lxc.txt
Last active January 15, 2022 19:59
gitlab on LXC Container (proxmox)
Um gitlab auf ubuntu 16.04 oder debian 8.5 zu installieren
(und wohl auch auf anderen ubuntus, debian hat noch zusätliche Probleme, dafür funktioniert aber z.B. top, htop, usw...)
müssen folgende Einstellungen in /etc/gitlab/gitlab.rb gesetzt sein:
postgresql['shared_buffers'] = "512MB" # recommend value is 1/4 of total RAM, up to 14GB.
postgresql['effective_cache_size'] = "128MB"
Beim ersten wird in der Config zum Start 256MB angeboten, reicht ggf. auch
Beim zweiten ist in der Config nur 1MB eingetragen, das kommt mir ggü. dem Standardwert von postgresql (128MB) zu wenig vor.
@jgillman
jgillman / restore.sh
Last active March 8, 2024 17:51
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@fernandoaleman
fernandoaleman / fix-libv8-mac.txt
Created May 5, 2016 15:14
Fixing libv8 and therubyracer on Mac
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
@geekmanager
geekmanager / make-git-use-sublime.markdown
Last active July 3, 2023 12:22
Making git use Sublime Text for rebase etc

Making git use Sublime Text

First up, let's make Sublime Text 2 available from the command line in terminal, by creating a link to subl which is the launcher from terminal:

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

(added bonus of this approach is when you upgrade to ST3 or change text editor, you can just redirect the symlink).

If there's any chance that bash doesn't check usr/local/bin then use [Launch Sublime Text 2 from Mac OSX Terminal] for more detailed instructions on how to make this happen.

@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@chikadance
chikadance / operations.rb
Created March 4, 2014 12:25
chunky_png: take a part of screenshot(see #crop)
module ChunkyPNG
class Canvas
# The ChunkyPNG::Canvas::Operations module defines methods to perform operations
# on a {ChunkyPNG::Canvas}. The module is included into the Canvas class so all
# these methods are available on every canvas.
#
# Note that some of these operations modify the canvas, while some operations return
# a new canvas and leave the original intact.
#
@scy
scy / delete-from-repo.md
Created September 20, 2013 11:54
How to delete a file from a Git repository, but not other users' working copies

How to delete a file from a Git repository, but not other users' working copies

Suppose you have, by mistake, added your IDE's project folder (you know, these .idea folders with all kinds of local paths and configuration data and settings in it) to the Git repository of your project. (We're talking about a whole folder here, but the same rules apply to individual files as well.)

Of course, you only realize that two days after the fact and have already pushed it, and your colleagues have already pulled it. They use the same IDE as you do, so whenever they change a setting or fix paths, they can either

  • commit that, causing nasty merge conflicts for you and others or
  • ignore the changes and carry around a modified file until the end of time without ever committing it.

Why .gitignore won't help