This file contains hidden or 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
/* | |
After purchasing a humble book bundle, go to your download page for that bundle. | |
Open a console window for the page and paste in the below javascript. | |
This will download all the books in all the formats available. | |
*/ | |
$('a').each(function(i){ | |
if (['MOBI', 'PDF', 'EPUB'].indexOf($.trim($(this).text())) >= 0) { | |
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">'); | |
document.getElementById('dl_iframe_'+i).src = $(this).data('web'); | |
} |
This file contains hidden or 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
from collections import namedtuple | |
from bs4 import BeautifulSoup as Soup | |
import requests | |
import json | |
from datetime import datetime, timedelta | |
import webbrowser | |
from collections import Counter | |
HB = 'https://www.humblebundle.com' | |
CONTENT = requests.get(HB).text |
This file contains hidden or 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
# https://www.codewars.com/kata/5842df8ccbd22792a4000245/train/python | |
def expanded_form(num): | |
num = list(str(num)) | |
store = [] | |
for i in range(len(num)): | |
x = int(num[i]) | |
if x > 0: | |
store.append(str(int(x * ( 10 ** (len(num) - int(i) - 1)) ))) | |
return ' + '.join(store) |
This file contains hidden or 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
function echocryptonumbers { | |
printf ' %-5s: %21s %7s %10s %9s\n' "COIN" "CURRENT VALUE" "1H" "24H" "7D" | |
# echo -e "Coin : Current Value 1h 24h 7d" | |
curl -s -H 'X-CMC_PRO_API_KEY: {CMC_PRO_API_KEY}' \ | |
-H 'Accept: application/json' \ | |
-d 'symbol=BTC,ETH,LTC' \ | |
-G https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest | \ | |
jq -r '.data | .[] | .symbol, .quote.USD.price, .quote.USD.percent_change_1h, .quote.USD.percent_change_24h, .quote.USD.percent_change_7d' | \ | |
while read -r SYMBOL; do | |
read -r PRICE |
This file contains hidden or 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
function cryptonumbers { | |
curl -H 'X-CMC_PRO_API_KEY: {CMC_PRO_API_KEY}' \ | |
-H 'Accept: application/json' \ | |
-d 'symbol=BTC,ETH,LTC' \ | |
-G https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest | \ | |
jq -r '.data | .[] | .symbol, .quote.USD.price' | \ | |
while read -r SYMBOL; do | |
read -r PRICE | |
echo -e "${SYMBOL} - \$${PRICE}" | |
done |
This file contains hidden or 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
// vanilla JS window width and height | |
var w=window, | |
d=document, | |
e=d.documentElement, | |
g=d.getElementsByTagName('body')[0], | |
x=w.innerWidth||e.clientWidth||g.clientWidth, | |
y=w.innerHeight||e.clientHeight||g.clientHeight; |
This file contains hidden or 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 | |
/** | |
* @param WP_Query|null $wp_query | |
* @param bool $echo | |
* | |
* @return string | |
* Accepts a WP_Query instance to build pagination (for custom wp_query()), | |
* or nothing to use the current global $wp_query (eg: taxonomy term page) | |
* - Tested on WP 4.9.5 |
This file contains hidden or 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
/* | |
* custom pagination with bootstrap .pagination class | |
* source: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/ | |
*/ | |
function bootstrap_pagination( $echo = true ) { | |
global $wp_query; | |
$big = 999999999; // need an unlikely integer | |
$pages = paginate_links( array( |
This file contains hidden or 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
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
This file contains hidden or 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
/* 11/27/2017 - Tweaked for a page redesign. | |
* 1/6/2018 - Handle videos in book bundle. | |
*/ | |
var pattern = /(MOBI|EPUB|PDF( ?\(H.\))?|CBZ)$/i; | |
var pattern2 = /(Download)$/; | |
var nodes = document.getElementsByTagName('a'); | |
var downloadCmd = ''; | |
for (i in nodes) { | |
var a = nodes[i]; | |
if (a && a.text && pattern.test(a.text.trim())) { |
NewerOlder