Skip to content

Instantly share code, notes, and snippets.

@vielhuber
vielhuber / script.js
Last active March 30, 2020 13:33
cookie block allow whitelist blacklist control #php #js
const whitelist = ['_gid'],
cookieDesc = Object.getOwnPropertyDescriptor(Document.prototype, 'cookie');
if (cookieDesc && cookieDesc.configurable) {
Object.defineProperty(document, 'cookie', {
get: () => {
return cookieDesc.get.call(document);
},
set: val => {
let accept = false;
whitelist.forEach(whitelist__value => {
@alexanderlerch
alexanderlerch / data-sets.md
Last active July 16, 2024 16:41
list of MIR datasets
dataset meta data contents with audio
200DrumMachines 7371 one-shots yes
AAM onsets, pitches, instruments, melody instrument, keys, chords, tempo, beats 3000 (artificial) tracks yes
ACM_MIRUM tempo 1410 excerpts (60s) yes
ACPAS aligned audio and scores 2189 performances of 497 scores downloadable
AcousticBrainz-Genre 15-31 genres with 265-745 subgenres audio features for over 2000000 songs no
SET
@orig_latitude = 32.867073,
@orig_longitude = -96.769410,
@radius = 10
;
SELECT *
FROM (
SELECT
`geonameid`, `name`,
@adfinlay
adfinlay / backstretch-overlay.css
Created October 23, 2014 09:51
Add pattern overlay to backstretch image
.backstretch:before {
content: "";
width: 100%;
height: 100%;
background: url("/images/pattern.png");
position: absolute;
}
@ahallora
ahallora / getSpotifyAccessToken
Last active March 17, 2023 09:44
Get Spotify Access Token (client credentials) with PHP and cURL
<?php
$client_id = '<insert your spotify app client id>';
$client_secret = '<insert your spotify app client secret>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://accounts.spotify.com/api/token' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, 'grant_type=client_credentials' );
@james2doyle
james2doyle / slugify.php
Last active January 12, 2022 13:19
Simple slugify function for PHP. Creates a slug for the passed string, taking into account international characters as well.
<?php
function slugify($string, $replace = array(), $delimiter = '-') {
// https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Utils/Slug.php
if (!extension_loaded('iconv')) {
throw new Exception('iconv module not loaded');
}
// Save the old locale and set the new locale to UTF-8
$oldLocale = setlocale(LC_ALL, '0');
setlocale(LC_ALL, 'en_US.UTF-8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
@adamloving
adamloving / temporary-email-address-domains
Last active May 31, 2024 15:43
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@vxnick
vxnick / gist:380904
Created April 27, 2010 15:52
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',