This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lists of countries with ISO 3166 codes, presented in various formats. | |
// Last Updated: July 30, 2020 | |
// If you're using PHP, I suggest checking out: | |
// https://github.com/thephpleague/iso3166 | |
// or Laravel: https://github.com/squirephp/squire | |
// | |
// JS developers can check out: | |
// https://www.npmjs.com/package/iso3166-2-db | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"bat_spawn_egg": {"id":"bat_spawn_egg", "legacy_id":"spawn_egg"}, | |
"blaze_spawn_egg": {"id":"blaze_spawn_egg", "legacy_id":"spawn_egg"}, | |
"cave_spider_spawn_egg": {"id":"cave_spider_spawn_egg", "legacy_id":"spawn_egg"}, | |
"chicken_spawn_egg": {"id":"chicken_spawn_egg", "legacy_id":"spawn_egg"}, | |
"cow_spawn_egg": {"id":"cow_spawn_egg", "legacy_id":"spawn_egg"}, | |
"creeper_spawn_egg": {"id":"creeper_spawn_egg", "legacy_id":"spawn_egg"}, | |
"donkey_spawn_egg": {"id":"donkey_spawn_egg", "legacy_id":"spawn_egg"}, | |
"elder_guardian_spawn_egg": {"id":"elder_guardian_spawn_egg", "legacy_id":"spawn_egg"}, | |
"enderman_spawn_egg": {"id":"enderman_spawn_egg", "legacy_id":"spawn_egg"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
item-0: | |
id: 38 | |
type: commands | |
item: | |
==: org.bukkit.inventory.ItemStack | |
v: 2230 | |
type: PHANTOM_SPAWN_EGG | |
meta: | |
==: ItemMeta | |
meta-type: SPAWN_EGG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # Add the following to config.inc.php | |
$cfg['Export']['sql_drop_database'] = true; | |
$cfg['Export']['sql_drop_table'] = true; | |
$cfg['Export']['compression'] = 'zip'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('posts_clauses', 'posts_clauses_with_tax', 10, 2); | |
function posts_clauses_with_tax( $clauses, $wp_query ) { | |
global $wpdb; | |
//array of sortable taxonomies | |
$taxonomies = array('example-taxonomy', 'other-taxonomy'); | |
if (isset($wp_query->query['orderby']) && in_array($wp_query->query['orderby'], $taxonomies)) { | |
$clauses['join'] .= " | |
LEFT OUTER JOIN {$wpdb->term_relationships} AS rel2 ON {$wpdb->posts}.ID = rel2.object_id | |
LEFT OUTER JOIN {$wpdb->term_taxonomy} AS tax2 ON rel2.term_taxonomy_id = tax2.term_taxonomy_id | |
LEFT OUTER JOIN {$wpdb->terms} USING (term_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Media renamer for Obfuscated file names sometimes found when downloading from usenet. | |
* This script will find scan all directories in $in_path. | |
* For each directory, it will search for a media file. | |
* If a media file is found, it will copy that file into the "output path" while also renaming the file to the "basepath" of the containing directory. | |
*/ | |
$find_extensions = ['mkv','avi']; | |
$remove_from_filename = ['-Obfuscated','-postbot']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Path to the Firefox Profiles directory | |
FF_PROFILE_PATH="$HOME/Library/ApplicationSupport/Firefox/Profiles" | |
# Get the "Default" path for your profile. | |
# Alternatively look for '*.dev-edition-default' | |
FF_PROFILE_DIR=`cd $FF_PROFILE_PATH; find . -maxdepth 1 -name '*.default' | cut -sd / -f 2-` | |
# Remove the localhost line in the file, and create a backup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/jq -jf | |
# Original Author: jolmg on HN (https://news.ycombinator.com/item?id=20246727) | |
# | |
# | |
# | |
# Author notes: | |
# You whitelist against what the syntax allows for identifiers and then you blacklist reserved keywords. | |
# Writing it this way makes it easier to verify for correctness when comparing with the ECMAScript Specs. | |
# This is still a non-exhaustive blacklist and the whitelist regex lacks allowed unicode characters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Minimidi Teensy Midi Controller | |
// Mike Walker (http://incredimike.com) | |
// Based on code originally by Philip Cunningham (http://philipcunningham.org) | |
// Smoothing hacked from http://www.arduino.cc/en/Tutorial/Smoothing | |
// Set midi channel to send to 1 | |
int channel = 1; | |
// Smoothing amount | |
const int numReadings = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function json_decode_nice($json, $assoc = FALSE){ | |
$json = str_replace(array("\n","\r"),"",$json); | |
$json = preg_replace('/([{,]+)(\s*)([^"]+?)\s*:/','$1"$3":',$json); | |
$json = preg_replace('/(,)\s*}$/','}',$json); | |
return json_decode($json,$assoc); | |
} | |
// Example: |
NewerOlder