Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Debugging

Thien Nguyen tatthien

👨‍💻
Debugging
View GitHub Profile
@tomhicks
tomhicks / plink-plonk.js
Last active Aug 5, 2020
Listen to your web pages
View plink-plonk.js
@joseluisq
joseluisq / currencies.json
Created Apr 3, 2018
JSON list of all currency symbols available from the Open Exchange Rates API - https://docs.openexchangerates.org/docs/currencies-json
View currencies.json
{
"AED": "United Arab Emirates Dirham",
"AFN": "Afghan Afghani",
"ALL": "Albanian Lek",
"AMD": "Armenian Dram",
"ANG": "Netherlands Antillean Guilder",
"AOA": "Angolan Kwanza",
"ARS": "Argentine Peso",
"AUD": "Australian Dollar",
"AWG": "Aruban Florin",
@vinkla
vinkla / CDN.md
Last active Aug 9, 2020
A guide on how to upload images to GitHub's CDN through issues and pull requests.
View CDN.md

Upload Images to GitHub's CDN

  1. First, visit any repository on GitHub and click your way through to the issues page.

  2. Create a new issue by clicking the New Issue button. You'll now see title and description fields.

  3. Drag-and-drop an image onto the description field. This will start the uploading process.

  4. Copy the URL and use it in README, issues or pull requests however you like.

@deanhume
deanhume / clear-cache.js
Created Sep 20, 2017
Clear Service Worker Cache
View clear-cache.js
if ('serviceWorker' in navigator) {
caches.keys().then(function(cacheNames) {
cacheNames.forEach(function(cacheName) {
caches.delete(cacheName);
});
});
}
@mofesolapaul
mofesolapaul / world-continents.php
Created Aug 2, 2017
PHP array of continents in the world and their countries
View world-continents.php
<?php
$continents = [
'Africa' => array('Algeria','Angola','Benin','Botswana','Burkina Faso','Burundi','Cabo Verde','Cameroon','Central African Republic','Chad','Comoros','Democratic Republic of the Congo','Republic of the Congo','Cote d\'Ivoire','Djibouti','Egypt','Equatorial Guinea','Eritrea','Ethiopia','Gabon','Gambia','Ghana','Guinea','Guinea Bissau','Kenya','Lesotho','Liberia','Libya','Madagascar','Malawi','Mali','Mauritania','Mauritius','Morocco','Mozambique','Namibia','Niger','Nigeria','Rwanda','Sao Tome and Principe','Senegal','Seychelles','Sierra Leone','Somalia','South Africa','South Sudan','Sudan','Swaziland','Tanzania','Togo','Tunisia','Uganda','Zambia','Zimbabwe'),
'NorthAmerica' => array('Antigua and Barbuda','Bahamas','Barbados','Belize','Canada','Costa Rica','Cuba','Dominica','Dominican Republic','El Salvador','Grenada','Guatemala','Haiti','Honduras','Jamaica','Mexico','Nicaragua','Panama','Saint Kitts and Nevis','Saint Lucia','Saint Vincent and the Grenadines','Trinidad and To
@jmickela
jmickela / gist:7c383c78af66a37a2446fe7eb733b157
Last active Dec 18, 2019
Trying to get PhpStorm to use git in Bash on Ubuntu on Windows (Windows Subsystem for Linux)
View gist:7c383c78af66a37a2446fe7eb733b157
There's a problem that you run into right away: you can't put a command line command, with arguments,
into the path to git executable box.
So putting something like bash.exe -c "git %*" isn't going to work. I wrote a small shell script that
fixes this, for both 32-bit and 64-bit systems.
@echo off
If %PROCESSOR_ARCHITECTURE% == x86 (
"C:\Windows\sysnative\bash.exe" -c "git %*"
) Else (
@dianjuar
dianjuar / Install update WordPress puglins directly.md
Last active Jun 26, 2020
Install update WordPress plugins without providing ftp access
View Install update WordPress puglins directly.md

Install WordPress plugins directly (without FTP)

Ref Stack Overflow Comment

Put this on your wp-config.php

/* That's all, stop editing! Happy blogging. */
define('FS_METHOD', 'direct');
@rambabusaravanan
rambabusaravanan / jquery.serializeObject.js
Last active Sep 30, 2019
jQuery Serialize Object (JSON)
View jquery.serializeObject.js
/**
* Usage: var json = $('#form-login').serializeObject();
* Output: {username: "admin", password: "123456"}
* Output: {username: "admin", password: "123456", subscription: ["news","offer"]}
* */
$.fn.serializeObject = function() {
var obj = {};
var arr = this.serializeArray();
arr.forEach(function(item, index) {
@pixeline
pixeline / ajax-handler-wp.php
Last active Jul 29, 2020
Custom ajax handler for Wordpress. Using admin-ajax.php, as is usually recommended, is very slow and does not allow the use of plugin shortcodes. Using a custom ajax handler like this bypasses that. http://wordpress.stackexchange.com/questions/170808/the-content-shows-shortcode-instead-of-parsing-it
View ajax-handler-wp.php
<?php
/*
WORDPRESS SPECIFIC AJAX HANDLER (because admin-ajax.php does not render plugin shortcodes).
by alexandre@pixeline.be
credits: Raz Ohad https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress
*/
//mimic the actual admin-ajax
define('DOING_AJAX', true);
if (!isset( $_REQUEST['action']))
@kerimdzhanov
kerimdzhanov / random.js
Last active Jul 27, 2020
JavaScript: get a random number from a specific range
View random.js
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {number} a random floating point number
*/
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
You can’t perform that action at this time.