Skip to content

Instantly share code, notes, and snippets.

View deadmantfa's full-sized avatar
🏠
Working from home

Wenceslaus Dsilva deadmantfa

🏠
Working from home
View GitHub Profile
@rsiddle
rsiddle / delayed-retargeting.js
Last active February 3, 2021 18:56
Hide Retargeting Cookies (Delayed Scripts)
/*
Description
Using the window.setTimeout function will allow you to hide retargeting cookies and execute them after 45 seconds.
This helps provide higher quality leads/audience. The example below shows Facebook's pixel tracker.
It could be used for other pixel tracking services too.
Case Study @ http://imscalable.com/blog/case-study-retargeting-done-wrong/
*/
// Facebook Code
@bedeabza
bedeabza / hexhsl.php
Created April 11, 2014 12:10
PHP Hex to HSL and HSL to Hex conversion
function hexToHsl($hex) {
$hex = array($hex[0].$hex[1], $hex[2].$hex[3], $hex[4].$hex[5]);
$rgb = array_map(function($part) {
return hexdec($part) / 255;
}, $hex);
$max = max($rgb);
$min = min($rgb);
$l = ($max + $min) / 2;
@surjikal
surjikal / nginx-cors.conf
Last active March 10, 2016 01:12 — forked from algal/nginx-cors.conf
Nginx CORS include file
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests
# - Access-Control-Max-Age=20days, to minimize repetitive OPTIONS requests
@jordanbyron
jordanbyron / save.js
Created September 27, 2011 12:00
Simple Save Changes Checker
/*
* save.js
* Track changes in a form and display a warning if they haven't been submitted
*
* Usage:
* Add 'data-track-changes=true' to any form which you want to track changes
*
* <form data-track-changes=true> ... </form>
*/
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@banterability
banterability / score.py
Created December 1, 2010 23:25
Time-based ranking algorithm influenced by Hacker News
# based on http://amix.dk/blog/post/19574
from datetime import datetime, timedelta
GRAVITY = 0.5 # HN default: 1.8
WINDOW = 36 # max age in hours
now = datetime.now()
def hours_from_dt(dt):