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/env python | |
# -*- coding: utf-8 -* | |
# Reference | |
# https://github.com/zslwyuan/google-ngrams/blob/master/getngrams.py | |
from nltk.corpus import words | |
from ast import literal_eval | |
from tqdm import tqdm | |
import requests |
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
// jquery shorthand | |
$(function(){ | |
// jQuery methods go here... | |
}); | |
// writing jQuery in WordPress | |
(function($) { | |
// Your jQuery code here, using the $ |
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 our Custom Fields to simple products | |
*/ | |
function mytheme_woo_add_custom_fields() { | |
global $woocommerce, $post; | |
echo '<div class="options_group">'; | |
// Text Field |
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/env python | |
# coding: utf-8 | |
# xlsx or csv to sql converter | |
# input file name will be the sql table name | |
# Usage: python3 xlsx_csv_to_sql_converter.py input_file.csv | |
import os | |
import sys | |
import csv |
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
// Selection object | |
//var selection = window.getSelection(); | |
var selection = window.getSelection ? window.getSelection() : document.selection; | |
// Selected plain text | |
var selected_text = selection.toString(); | |
// Range object | |
var range = selection.getRangeAt(0); |
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
""" | |
url matching regex | |
http://daringfireball.net/2010/07/improved_regex_for_matching_urls | |
""" | |
""" | |
The regex patterns in this gist are intended to match any URLs, | |
including "mailto:foo@example.com", "x-whatever://foo", etc. For a | |
pattern that attempts only to match web URLs (http, https), see: |