Skip to content

Instantly share code, notes, and snippets.

View StanBoyet's full-sized avatar

Stanislas Boyet StanBoyet

View GitHub Profile
@StanBoyet
StanBoyet / mysql_installation_error.md
Created November 25, 2015 11:11
ERROR: Error installing mysql: ERROR: Failed to build gem native extension

Another way for MacOS users

If you used "brew" to install mysql:

gem install mysql2 -v 'x.x.x' -- --with-mysql-config=/usr/local/Cellar/mysql/y.y.y/bin/mysql_config

x.x.x = version of the mysql2 gem you want to install

@StanBoyet
StanBoyet / gist:0b23d695164f2125dfdf
Created November 12, 2015 19:36 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@StanBoyet
StanBoyet / Rakefile
Last active August 29, 2015 14:19 — forked from barrettclark/Rakefile
require 'rake'
# http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
require 'net/http'
desc "this is a test"
task :testing_rake do
puts "Hello from rake!"
end
namespace :remote_file do

$ psql psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Solved by :

rm /usr/local/var/postgres/postmaster.pid

DISABLED_TASKS = [
'db:drop',
'db:migrate:reset',
'db:schema:load',
'db:seed',
# ...
]
namespace :db do
desc "Disable a task in production environment"
def generate_random_string(length)
rand(36**length).to_s(36)
end
@StanBoyet
StanBoyet / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@StanBoyet
StanBoyet / sort_with_jquery.md
Created November 18, 2014 18:37
Sort elements with jQuery

from http://trentrichardson.com/2013/12/16/sort-dom-elements-jquery/

I wanted to share a quick snippet that I worked up for a unique scenario. Occasionally you want to sort or display DOM elements in a certain order. For instance, what if you have a list of names. A feature of your site may be that you can sort the list by first name, or last name. There are a few ways you can approach this.

One approach may be using a javascript framework like Backbone or Angular, where you have a model and collection. Then simply sort the collection, magic happens, and your list is essentially regenerated.

The other could be that you’re not using a framework and not want to regenerate the entire list, but to move the nodes. It is actually rather simple. Lets say you have a list like the following: