Skip to content

Instantly share code, notes, and snippets.

View JulienSansot's full-sized avatar

Julien Sansot JulienSansot

View GitHub Profile
@JulienSansot
JulienSansot / intercept error in angular.js
Created June 10, 2016 09:16
intercept error in angular
(function(){
var httpInterceptor = function ($provide, $httpProvider) {
$provide.factory('httpInterceptor', function ($q) {
return {
response: function (response) {
return response || $q.when(response);
},
responseError: function (rejection) {
@JulienSansot
JulienSansot / Vagrantfile
Last active June 6, 2016 01:22
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@JulienSansot
JulienSansot / android emulator with http proxy.sh
Created June 2, 2016 09:23
android emulator with http proxy
/Users/{user}/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5_API_22 -http-proxy 192.168.60.1:8888
openssl x509 -in apn.pem -noout -text
@JulienSansot
JulienSansot / utc time like in MySQL.sh
Created May 25, 2016 01:42
utc time like in MySQL
$ date -u "+%Y-%m-%d %H:%M:%S"
2016-05-25 01:03:14
@JulienSansot
JulienSansot / center image with overflow hidden.css
Created May 20, 2016 05:00
center image with overflow hidden
div.preview_image{
height: 90px;
width: 91px;
overflow: hidden;
position: relative;
img {
position: absolute;
top: -100%;
bottom: -100%;
@JulienSansot
JulienSansot / get_bt_id.sh
Created May 18, 2016 02:08
Get the id of Bluetooth device
# examples :
#
# get the integrated BT :
# ./get_bt_id.sh UART
#
# get the USB BT :
# ./get_bt_id.sh USB
bt_type=$1
@JulienSansot
JulienSansot / Logentries Tags
Last active May 9, 2016 01:20
Logentries Tags
Errors, pattern: (FATAL) NOT (No route matches [GET]) NOT (No route matches [HEAD])
@JulienSansot
JulienSansot / 0_reuse_code.js
Created April 11, 2016 05:12
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
@JulienSansot
JulienSansot / Determine third point of triangle when two points and all sides are known.js
Created April 6, 2016 10:51
Determine third point of triangle when two points and all sides are known
//a,b,c are the sides of the triangle
function get_third_point_coordinates(a, b, c){
var result = {x:0,y:0};
if(a > 0){
result.x = (c*c - b*b + a*a) / (2*a);
}
result.y = Math.sqrt(c*c - result.x*result.x);