Skip to content

Instantly share code, notes, and snippets.

View pthalamy's full-sized avatar
🚀

Pierre Thalamy pthalamy

🚀
View GitHub Profile
@srph
srph / oauth.js
Created February 21, 2016 13:50
axios: interceptor which includes your oauth token in every request as an Authorization header
import axios from 'axios';
// You can use any cookie library or whatever
// library to access your client storage.
import cookie from 'cookie-machine';
axios.interceptors.request.use(function(config) {
const token = cookie.get(__TOKEN_KEY__);
if ( token != null ) {
config.headers.Authorization = `Bearer ${token}`;
@SoldierCorp
SoldierCorp / main.js
Created February 15, 2016 03:14
Javascript nl2br
function nl2br(str) {
var break_tag = '<br>';
return (str + '').replace(/([^>rn]?)(rn|nr|r|n)/g, '' + break_tag + '');
}
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active April 23, 2024 13:04
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@randyburden
randyburden / OwinRequestExtensions.cs
Created October 22, 2014 00:40
OwinRequest extensions for getting query string, form body, and header parameters as Dictionary<string,string>
/// <summary>
/// Owin Request extensions.
/// </summary>
public static class OwinRequestExtensions
{
/// <summary>
/// Gets the combined request parameters from the form body, query string, and request headers.
/// </summary>
/// <param name="request">Owin request.</param>
/// <returns>Dictionary of combined form body, query string, and request headers.</returns>
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active May 1, 2024 03:45
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@cazepeda-zz
cazepeda-zz / window.location.href
Created October 28, 2012 02:02
Bookmarklet to append a string to the end of a URL
window.location.href
====================
Bookmarklet to append a string to the end of the URL.
1. Create bookmark.
2. Edit bookmark URL(Chrome) / Location(Firefox) to include this code: javascript:window.location.href=window.location.href+'REPLACETHIS';
3. Now make use of that bookmarklet.
@fmela
fmela / stacktrace.cxx
Last active September 22, 2023 10:58
A C++ function that produces a stack backtrace with demangled function & method names.
/*
* Copyright (c) 2009-2017, Farooq Mela
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright