A very basic regex-based Markdown parser. Supports the
following elements (and can be extended via Slimdown::add_rule()
):
- Headers
- Links
- Bold
#!/bin/bash | |
# from | |
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html | |
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png | |
convert favicon-256.png -resize 16x16 favicon-16.png | |
convert favicon-256.png -resize 32x32 favicon-32.png | |
convert favicon-256.png -resize 64x64 favicon-64.png | |
convert favicon-256.png -resize 128x128 favicon-128.png |
var user = { | |
validateCredentials: function (username, password) { | |
return ( | |
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
: false | |
); |
A very basic regex-based Markdown parser. Supports the
following elements (and can be extended via Slimdown::add_rule()
):
# Local Dates: | |
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt | |
# ISO Dates: | |
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt |
In Silex, the most common way to define the controller of a route is with a
closure. But when your project gets bigger, you want to organize your code in
classes. You can use the syntax ClassName::methodName
in your route
definition instead of a function () { ... }
but you have to inject the
Silex\Application $app
as a parameter on each method of your controller
class, which can become quite boring.
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
<?php | |
/** | |
* Add "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.) | |
*/ | |
function hip_widget_first_last_classes( $params ) { | |
global $my_widget_num; // Global a counter array | |
$this_id = $params[0]['id']; // Get the id for the current sidebar we're processing | |
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets |
'OpenOffice Basic macro for exporting a .ods spreadsheet to JSON (and CSV) | |
'Project-specific formating I implemented: cull empty or "0" entries, '^' as separator value for the csv | |
REM ***** BASIC ***** | |
Sub Main | |
'First export to CSV which we will later use as the source for the export to json | |
Dim Propval(1) as New com.sun.star.beans.PropertyValue | |
Propval(0).Name = "FilterName" |
Graphic via State of Florida CFO Vendor Payment Search (flair.myfloridacfo.com)
This is a quick command I use to snapshot webpages that have a fun image I want to keep for my own collection of WTFViz. Why not just right-click and save the image? Oftentimes, the webpage in which the image is embedded contains necessary context, such as captions and links to important documentation just incase you forget what exactly that fun graphic was trying to explain.
if ('NodeList' in window && !NodeList.prototype.forEach) { | |
console.info('polyfill for IE11'); | |
NodeList.prototype.forEach = function (callback, thisArg) { | |
thisArg = thisArg || window; | |
for (var i = 0; i < this.length; i++) { | |
callback.call(thisArg, this[i], i, this); | |
} | |
}; | |
} |