Skip to content

Instantly share code, notes, and snippets.

View michaelbaudino's full-sized avatar

Michael Baudino michaelbaudino

View GitHub Profile
@michaelbaudino
michaelbaudino / browser.js.coffee
Last active December 16, 2015 12:38
Implémentation Paymill (code du slide #27 de mon talk à Lyon.rb le 10/04/2013 : http://michaelbaudino.github.io/presentation-paiements).
# Initialize Paymill public API key
window.PAYMILL_PUBLIC_KEY = '8a8394c13bb2c160013bb7f6af8a1c85'
# Retrieve Paymill javascript snippet (the "bridge")
$.getScript('https://bridge.paymill.com')
# This should be called when the user validates the HTML form
paymill.createToken
number: $('#card-number').val() # required, without spaces and hyphens
exp_month: $('#card-expiry-month').val() # required
@michaelbaudino
michaelbaudino / bc-in-shell.sh
Last active December 6, 2016 02:06
Bash (and probably other POSIX shells) functions and aliases to use bc directly from the prompt
### Functions to use bc from prompt
### paste this in your ~/.bashrc or ~/.bash_profile
### based on http://brettterpstra.com/2011/02/02/quick-calculations-in-bash/
# Basic functions displaying result of operations
function calc() { # Default precision used is 2
equat=$(echo ${@//[^-0-9\.\+\/\*\(\)]/ } | sed 's/[ \t]*//g')
echo -e "scale=2\n$equat\nquit\n" | bc -lq
}
function calc3() { # Default precision 3
@michaelbaudino
michaelbaudino / git-in-prompt.sh
Last active August 30, 2021 08:57
Bash prompt with GIT branch and status display
### Michael Baudino <[email protected]>
### License: WTFPL
###
### To use this fancy prompt:
### 1. copy this file as ~/.git-in-prompt.sh
### 2. add the following line to your ~/.bashrc file:
### [[ -s "$HOME/.git-in-prompt.sh" ]] && source "$HOME/.git-in-prompt.sh"
### 3. enjoy :-)
###