Skip to content

Instantly share code, notes, and snippets.

View wilmoore's full-sized avatar

Wil (₩) Moore III wilmoore

View GitHub Profile
@wilmoore
wilmoore / ls
Created February 14, 2012 03:04
Multi-Version PHP w/ own php.ini: $PHP_ROOT/etc{,.d}
WM3MBP:5.3.10 wilmoore$ pwd && ls etc{,.d}
/Users/wilmoore/local/php/versions/5.3.10
etc:
total 192
drwxr-xr-x 5 wilmoore staff 170B Feb 11 22:32 .
drwxr-xr-x 11 wilmoore staff 374B Feb 11 20:42 ..
-rw-r--r-- 1 wilmoore staff 1.5K Feb 11 20:43 pear.conf
-rw-r--r-- 1 wilmoore staff 21K Feb 11 20:42 php-fpm.conf.default
-rw-r--r-- 1 wilmoore staff 68K Feb 11 22:32 php.ini
{ "inline":
{ "unicode-support-in-js-today":"💩"
, "unicode-support-in-js-someday":"😁" }
, "surrogates":
{ "unicode-support-in-js-today":"\uf09f\u92a9"
, "unicode-support-in-js-someday":"\uf09f\u9881" }
}

Variadic argument support in LESS 1.3.0

.mixin (...) {        // matches 0-N arguments
.mixin () {           // matches exactly 0 arguments
.mixin (@a: 1) {      // matches 0-1 arguments
.mixin (@a: 1, ...) { // matches 0-N arguments
.mixin (@a, ...) {    // matches 1-N arguments
@pheuter
pheuter / sc-dl.js
Created March 5, 2012 20:44
Bookmarklet that generates download link for a Soundcloud upload
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);
@wilmoore
wilmoore / installer
Created March 8, 2012 05:45
composer installer
#!/usr/bin/env php
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <[email protected]>
* Jordi Boggiano <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
@wilmoore
wilmoore / jQuery.ScrollTo.js
Created March 9, 2012 17:09
Various Anchor Scroll Implementations
// SEE: http://demos.flesler.com/jquery/scrollTo/
@wilmoore
wilmoore / with_5.4.php
Created March 20, 2012 19:23 — forked from ruprict/build_params.php
Retrieve whitelisted set of parameters
<?php
function filter_params(array $params = [], array $whitelist = []) {
return array_map('trim', array_intersect_key($params, array_flip($whitelist)));
}
$params = ['is_admin' => 1, 'name' => ' Bob', 'surname' => 'Smith '];
$whitelist = ['name', 'surname'];
// these are your whitelisted parameters (please don't forget to filter/validate before persisting)
@wilmoore
wilmoore / width_71.php
Created March 21, 2012 05:29
80 character limit is unreasonable and unattractive
// breaks on 71st character -- breaking on 7x characters seems unreasonable
public function setAuthSubPrivateKeyFile($file, $passphrase = null,
$useIncludePath = false) {
@wilmoore
wilmoore / user_tz_to_utc.php
Created April 5, 2012 16:48
Playing with DateTime and DateTimeZone
<?php
// assume these preferences came from a database as-is
$userTimezonePreference = 'America/Denver';
$userStoredDateTime = '2012-04-02 00:15:40';
$dateTime = new DateTime($userStoredDateTime, new DateTimeZone($userTimezonePreference));
echo 'ORIG: ', $dateTime->format(DateTime::RFC2822), PHP_EOL;
$dateTime->setTimezone(new DateTimeZone('UTC'));
echo 'USER: ', $dateTime->format(DateTime::RFC2822), PHP_EOL;
@unclebob
unclebob / apology.
Created April 27, 2012 12:19
Apology to Women Programmers.
Today I gave a keynote at ACCU in Oxford. In the midst of it I made two (count them) two statements that I should have known better than to make. I was describing the late '70s, and the way we felt about the C language at the time. My slide said something like: "C was for real men." Emily Bache, whom I know and hold in high regard, spoke up and said "What about women?". And I said something like: "We didn't allow women in those days." It was a dumb crack, and should either not have been said, or should have been followed up with a statement to the effect that that was wrong headed.
The second mistake I made was while describing Cobol. I mentioned Adm. Grace Hopper. I said something like "May she rest in peace." I don't know that any of the words were actually demeaning, but the tone was not as respectful as it should have been to an Admiral in the United State Navy, and one who was so instrumental in our industry; despite what I feel about Cobol.
I am a 59 year old programmer who was brought up