Skip to content

Instantly share code, notes, and snippets.

View leucos's full-sized avatar
👽
Waiting for aliens

Michel Blanc leucos

👽
Waiting for aliens
View GitHub Profile
@leucos
leucos / pre-commit.sh
Last active August 29, 2019 08:26 — forked from radlinskii/pre-commit.sh
This is a pre-commit hook file for working in Go. Be sure to save this file in your repository as `.git/hooks/pre-commit` and give it right to execute e.g. with command `chmod +x .git/hooks/pre-commit`
#!/bin/bash
STAGED_GO_FILES=$(git diff --cached --name-only -- "\.go$")
if [[ "$STAGED_GO_FILES" = "" ]]; then
exit 0
fi
GOLINT=$GOPATH/bin/golint
GOIMPORTS=$GOPATH/bin/goimports
@leucos
leucos / ansible-role-test.sh
Last active September 13, 2018 08:08 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
@leucos
leucos / model_generator.rb
Created April 24, 2012 13:52 — forked from Pilooz/model_generator.rb
Sequel model generator for mysql
# Sequel Basic Scafolding Model Generator for MySQL
# This routine takes all the table of a database, en generates all Sequel models for Ramaze
# For each table model we put :
# - A header that reminds you the table structure
# - the plugin list you wrote in 'plugin_to_add' array
# - The Sequel referential inegrity : one_to_many, many_to_one
# - A "Validate" method that checks not nullable columnns and unique columns
# - Generates init.rb to be include in the project
#
# Note : db_connect.rb should already exists. Create it using Rake
@leucos
leucos / README.markdown
Created March 28, 2012 15:35 — forked from deepakdargade/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string