Skip to content

Instantly share code, notes, and snippets.

View yandeu's full-sized avatar
🌴
On vacation until mid August

Yannick yandeu

🌴
On vacation until mid August
View GitHub Profile
@henrik
henrik / eu_country_codes.rb
Last active December 20, 2023 12:20
EU (European Union) country codes, ISO 3166-1 alpha-2. (This Gist is from 2012. Please see comments for updates.)
# Note: VAT identification numbers for Greece use "EL", not "GR".
COUNTRY_CODES_EU = %w[
AT BE BG CY CZ DK EE FI FR DE GR HU IE IT
LV LT LU MT NL PL PT RO SK SI ES SE GB
]
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@satooshi
satooshi / .htaccess
Created September 2, 2012 14:49
mod_rewrite for front controller
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# skip existent files
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule index.php - [QSA,L,C]
RewriteRule .* - [QSA,L]
# deny access php files
@davidtheclark
davidtheclark / isElementInViewport.js
Created May 4, 2013 02:00
JavaScript: Is element in viewport?
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
@plentz
plentz / nginx.conf
Last active July 22, 2024 11:19
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@eric-wu
eric-wu / nginx.conf
Last active October 27, 2022 01:45
Nginx reverse proxy set up behind a elastic load balancer and in front of a Play web app. Redirects http to https.
# This sets up a nginx reverse proxy behind a load balancer and in front of
# the Play web app. The setup is illustrated as the following:
#
# LB:80 ==> RP:80 ==> (Redirect to https)
# LB:443 ==> RP:8080 ==> Backend:9001
#
# LB -- Load Balancer
# RP -- Reverse Proxy
#
# IMPORTANT: Remove the line `include /etc/nginx/sites-enabled/*` from this config
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@gavinhungry
gavinhungry / nginx-tls.conf
Last active July 18, 2024 11:35
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#
@torgeir
torgeir / react-scaled-file-upload.js
Created March 25, 2015 12:16
React scaled file upload
function resize (file, maxWidth, maxHeight, fn) {
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function (event) {
var dataUrl = event.target.result;
var image = new Image();
image.src = dataUrl;
image.onload = function () {
@f6p
f6p / metaeditor.ini
Last active October 1, 2020 17:34
MT4 Code Editor Monokai Theme
[Font]
Bold=700
FaceName=Consolas
Height=10
[Colors]
Color0=2304040
Color1=16119285
Color2=6255480
Color3=2963255
Color4=2304040