Skip to content

Instantly share code, notes, and snippets.

View cedeber's full-sized avatar
🦀
Rustacean

Cédric Eberhardt cedeber

🦀
Rustacean
View GitHub Profile
@cedeber
cedeber / 1px.html
Created May 6, 2016 08:42 — forked from jaynzr/1px.html
1px transparent pixel
<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">
@cedeber
cedeber / selenium_async.js
Last active April 27, 2016 06:37
Selenium Async
var should = require( "should" ),
webdriver = require( "selenium-webdriver" ),
test = require( "selenium-webdriver/testing" );
test.describe( "MouseEvent", function () {
var driver, windo;
this.timeout( 5000 );
test.before( function () {
@cedeber
cedeber / navbar.html
Last active April 27, 2016 06:38
SVG Navigation Bar - Browser-like
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.navbar {
overflow: hidden;
border: solid 1px #dbdbdb;
border-radius: 5px 5px 0 0;
line-height: 0;
@cedeber
cedeber / ajax.js
Created March 22, 2016 14:14
AJAX requests
var myRequest = new XMLHttpRequest();
myRequest.open("GET", url + ((/\?/).test(url) ? "&" : "?") + (new Date()).getTime());
myRequest.open("POST", "http://www.cedeber.fr/");
myRequest.setRequestHeader("Cache-Control", "no-cache");
myRequest.setRequestHeader("Content-Type", "text/plain");
myRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
myRequest.onload = myOnLoadHandlerFunction;
myRequest.send(data||params);
@cedeber
cedeber / rm_icon_cache.sh
Last active October 3, 2018 07:16 — forked from fabiofl/gist:5873100
Clear Mac OS X's icon cache.
# See https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/ConfiguringSystemIntegrityProtection/ConfiguringSystemIntegrityProtection.html
# csrutil disable and enable (Cmd+R on reboot)
# https://furbo.org/2015/01/19/clearing-the-icon-services-cache-in-yosemite/
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \;
sudo rm -rf /Library/Caches/com.apple.iconservices.store
@cedeber
cedeber / ajax_uncache.js
Last active February 3, 2016 09:52
Avoid AJAX request cache with a dummy parameter
function uncache( url ) {
var uncached = Math.round( Math.random() * 10000 ) + Date.now();
uncached = ( /\?/.test( url ) ? "&" : "?" ) + "_=" + uncached;
return url + uncached;
}
@cedeber
cedeber / invert.js
Created January 27, 2016 10:34
Invert Values
if ( min > max ) {
max = [ min, min = max ][ 0 ];
}
@cedeber
cedeber / svg_length.js
Created May 5, 2015 08:51
Get length of a SVG path
path.getTotalLength();
@cedeber
cedeber / .bash_profile
Last active January 26, 2016 20:09
OSX Bash Profile
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GF'
alias ll='ls -l'
alias la='ls -la'
@cedeber
cedeber / pb.sh
Created March 26, 2015 12:46
Copy & paste clipboard on OS X
echo 'lol' | pbcopy
pbpaste > file.txt