Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
import Data.Bits | |
import Data.Word | |
import System.Random | |
mtN = 624 | |
mtM = 397 | |
data MersenneTwister = MersenneTwister [Word32] Int | |
deriving Show |
#!/usr/bin/env python | |
# coding: utf-8 | |
class AttrDict(object): | |
def __init__(self, init=None): | |
if init is not None: | |
self.__dict__.update(init) | |
def __getitem__(self, key): | |
return self.__dict__[key] |
<?php | |
/** | |
* Custom Add To Cart Messages | |
* Add this to your theme functions.php file | |
**/ | |
add_filter( 'woocommerce_add_to_cart_message', 'custom_add_to_cart_message' ); | |
function custom_add_to_cart_message() { | |
global $woocommerce; | |
// Output success messages |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.
/** | |
* An array forEach with a delay between steps. | |
* | |
* @param {Function} callback Function to execute for each element. It receives three arguments, the element value, the element index and the array being traversed, respectivily. | |
* @param {Number} timeout Number of milliseconds that the function call should be delayed by. | |
* @param {Object} thisArg Object to use as this when executing callback. | |
* @this {Array} | |
* @return {undefined} | |
*/ | |
Array.prototype.delayedForEach = function(callback, timeout, thisArg){ |
I should preface this by saying that I got a Withings Smart Body Analyzer for Christmas last year and I’ve been generally happy with it. It purports to be able to take my heart rate through my bare feet and that seems not to work for my physiology, but overall I’m a fan. If if their Wikipedia page is to be believed they are having a pretty rad impact on making the Quantified Self movement more for normal people and they only have 20 full time employees. Also they try hard to use SI units, which I can get behind. Anyway, on to the rant.
I originally called this post “Everything wrong with the Withings API” and I meant it. For every useful field I can extract from their “award winning” app, I have spent an hour screaming at the inconsistencies in their implementation or inexplicable holes in their data
# The initial version | |
if [ ! -f .env ] | |
then | |
export $(cat .env | xargs) | |
fi | |
# My favorite from the comments. Thanks @richarddewit & others! | |
set -a && source .env && set +a |
<?php | |
$course = LP_Course::get_course( get_the_ID() ); | |
// SECTIONS / MODULES | |
$sections = $course->get_curriculum(); | |
if ( $sections ) { | |
$items = $course->get_curriculum_items( array( 'group' => true ) ); | |
$count_sections = sizeof( $sections ); | |
$count_lessons = sizeof( $items['lessons'] ); |