NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
/* | |
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace | |
so it's better encapsulated. Now you can have multiple random number generators | |
and they won't stomp all over eachother's state. | |
If you want to use this as a substitute for Math.random(), use the random() | |
method like so: | |
var m = new MersenneTwister(); |
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
(function($) { | |
$.fn.random = function(qty) { | |
var $pool = this, | |
$picks = $(), | |
$e; | |
qty = qty || 1; | |
while (qty) { | |
$e = $pool.eq(~~(Math.random() * $pool.length)); | |
$picks = $picks.add($e); | |
$pool = $pool.not($e); |
#!/usr/bin/env bash | |
# | |
# Wraps curl with a custom-drawn progress bar. Use it just like curl: | |
# | |
# $ curl-progress -O http://example.com/file.tar.gz | |
# $ curl-progress http://example.com/file.tar.gz > file.tar.gz | |
# | |
# All arguments to the program are passed directly to curl. Define your | |
# custom progress bar in the `print_progress` function. | |
# |
#!/usr/bin/env ruby | |
message_file = ARGV[0] | |
message = File.read(message_file) | |
def range_rand(min,max) | |
min + rand(max-min) | |
end | |
bads = [ | |
"Yeah, bitch! Magnets!", |
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.
# Bulk convert shapefiles to geojson using ogr2ogr | |
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/ | |
# Note: Assumes you're in a folder with one or more zip files containing shape files | |
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere) | |
#geojson conversion | |
function shp2geojson() { | |
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp" | |
} |
<?php | |
/** | |
* I18N class for translating text to any language | |
* Uses YAML files | |
* | |
* Usage: I18N::t("user.name") # => "Karl Metum" | |
* In the above example "name" is nested under "user" | |
* | |
* Make sure that the following constants are set in | |
* your configuration file: |