Skip to content

Instantly share code, notes, and snippets.

Lewis Cowles Lewiscowles1986

Block or report user

Report or block Lewiscowles1986

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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
Lewiscowles1986 / getWP.sh
Created Oct 3, 2014
install / update wordpress
View getWP.sh
#!/bin/sh
sudo apt-get update && apt-get install unzip
wget http://wordpress.org/latest.zip
unzip -o -u latest.zip
@Lewiscowles1986
Lewiscowles1986 / test.dt.human.php
Created Dec 9, 2014
Testing Human date / time
View test.dt.human.php
<?php
//
// setup
//
date_default_timezone_set('Europe/London');
//
// code to test
//
$post_time = get_the_time( 'U' );
View gist.md

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
Lewiscowles1986 / Random.php
Last active Aug 29, 2015
fantastic secure random bytes from native PHP
View Random.php
<?php
namespace lewiscowles\security {
Class Random {
const SECRANDSRC = '/dev/urandom';
const DEFAULT_RANDOM_BYTES = 16;
public static function getTrueRandomBytes( $cnt=16 ) {
$out = '';
@Lewiscowles1986
Lewiscowles1986 / TextColorHelper.php
Created Jan 18, 2015
PHP Bash colour re-factor...
View TextColorHelper.php
<?php
namespace {
use \lewiscowles\nix\terminal\bash\TextColorHelper;
$bashTxt = new TextColorHelper();
$bashTxt->setString( 'Normal Text' )
->output()
->setString( 'Less Normal Text', 'light_purple' )
->output()
->setString( 'Success', 'light_green' )
@Lewiscowles1986
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
collections:
content-sections:
output: true
title: Content Sections
# Continue with other collections
@Lewiscowles1986
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>
View get_otto.sh
#!/bin/sh
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(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 https://dl.bintray.com/mitchellh/otto/otto_0.1.1_linux_amd64.zip -O otto.zip
unzip otto.zip
rm otto.zip
mv otto /usr/local/bin/otto
@Lewiscowles1986
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;
}
//
You can’t perform that action at this time.