Skip to content

Instantly share code, notes, and snippets.

View Guillaumejfrt's full-sized avatar

Guillaume Jauffret Guillaumejfrt

View GitHub Profile
@antoineayoub
antoineayoub / gist:c4d1a6fcacb105a9b83d997388c67bb2
Last active September 28, 2017 15:43
redux_container_list_boilerplate
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { $ACTION } from '../actions';
class $LIST_CONTAINER extends Component {
componentWillMount() {
this.props.$ACTION();
}
@subfuzion
subfuzion / curl.md
Last active February 21, 2026 17:28
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active March 13, 2026 08:37
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@feugy
feugy / roller-coaster.js
Last active February 12, 2021 07:45
Solution for coding game "Roller Coaster" - https://www.codingame.com/games/puzzles/27 (queueing, optimization)
// enqueue all people waiting to ride
let [spaces, maxRide, n] = readline().split(' ').map(n => +n)
let queue = []
for (let i = 0; i < n; i++) {
queue.push(+readline())
}
// cache previous pattern:
// key is index of the next group to wait
// value is an array containing the number of occupied sits (0) and index of the next group to wait (1)
@olivierlacan
olivierlacan / migrate_postgresql_database.md
Last active March 2, 2026 06:35
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@brianburridge
brianburridge / gist:8d2755a73dd5b4f0332b
Created December 10, 2014 19:47
Export local db to JSON
namespace :json do
desc "Export all data to JSON files"
task :export => :environment do
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|
file = File.open(File.join(Rails.root, "db", "export", "#{model.table_name}.json"), 'w')
file.write model.all.to_json
file.close
end