Skip to content

Instantly share code, notes, and snippets.


Lewis Cowles Lewiscowles1986

View GitHub Profile
View gist:ed1646c6e5d610abe164
echo time()."\r\n";
var_dump( microtime_str() );
var_dump( microtime_str() );
var_dump( microtime_str() );
var_dump( microtime_str() );
var_dump( microtime_str() );
var_dump( microtime_str() );
var_dump( microtime_str() );
var_dump( microtime_str() );
var_dump( microtime_str() );
Lewiscowles1986 /
Created Oct 3, 2014
install / update wordpress
sudo apt-get update && apt-get install unzip
unzip -o -u
Lewiscowles1986 / test.dt.human.php
Created Dec 9, 2014
Testing Human date / time
View test.dt.human.php
// setup
// code to test
$post_time = get_the_time( 'U' );

Problem #1

God algorithms, God solutions etc, God methods etc often add unnesecarry complexity with very little benefit. There is no God, get over that...

Shipow: Even if I don't support religions, I'm pretty ok with the idea of an omnipotent mind as it stay in the context of narration. And I guess that even someone very trustfull will never imagine God as web/app designer ;)

Problem #2

Lack of evidence for decisions... I could understand iteratively improving a design because nobody gets "sign up", "sign in"... if it EVER happened! Jeff even admits there is little evidence against "sign up" / "sign in", and the link seems to be to some stackoverflow o similar upvoting thread (thus promoting over-simplification, lack of engagement and pack mentality common on such services)... The truth is "sign up", "sign in" is not confusing, unless you do not speak english, then you have bigger problems than "sign up", "sign in"... You know like using any of the interface...

Lewiscowles1986 / Random.php
Last active Aug 29, 2015
fantastic secure random bytes from native PHP
View Random.php
namespace lewiscowles\security {
Class Random {
const SECRANDSRC = '/dev/urandom';
public static function getTrueRandomBytes( $cnt=16 ) {
$out = '';
Lewiscowles1986 / TextColorHelper.php
Created Jan 18, 2015
PHP Bash colour re-factor...
View TextColorHelper.php
namespace {
use \lewiscowles\nix\terminal\bash\TextColorHelper;
$bashTxt = new TextColorHelper();
$bashTxt->setString( 'Normal Text' )
->setString( 'Less Normal Text', 'light_purple' )
->setString( 'Success', 'light_green' )
Lewiscowles1986 / _config.yml
Created Jun 23, 2015
Jekyll Content Sections - Port of CD2 content-sections WordPress Plugin
View _config.yml
# Find your Start of collections
output: true
title: Content Sections
# Continue with other collections
Lewiscowles1986 / tag_cloud.html
Created Jun 23, 2015
Tag Cloud Include for Jekyll
View tag_cloud.html
{% assign all_tags = site.tags|size %}
<div class="tagcloud">{% for tag in site.tags %}
{% assign tag_name = tag|first %}
{% assign tag_count = tag|last|size %}
{% assign tag_avg = tag_count | div: all_tags %}
<span class="tag" style="font-size: {{ tag_avg | times: 100 }}%;">{{ tag_name }}</span>{% if false %} ({{ tag_count }}){% endif %}
{% endfor %}</div>
wget -q -O- | sudo apt-key add -
sudo sh -c 'echo "deb $(lsb_release -cs) contrib" > /etc/apt/sources.list.d/virtualbox.list'
sudo apt-get update -y
sudo apt-get install -y dkms unzip virtualbox-5.0 vagrant
wget -O
mv otto /usr/local/bin/otto
Lewiscowles1986 / rand.js
Last active Oct 29, 2015
JavaScript Random Numbers
View rand.js
function rand( min, max ) {
var seed = Math.random();
if( typeof min != 'number' && typeof max != 'number' ) {
return seed; // default is just random
} else if( typeof min == 'number' && typeof max != 'number' ) {
return Math.round( seed * min );
} return Math.floor( seed * max ) + min;