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
@Lewiscowles1986
Lewiscowles1986 / src\ReadingTime.php
Last active Dec 29, 2015
PHP Estimated Read Time
View src\ReadingTime.php
<?php
namespace lewiscowles\utils\cms;
class ReadingTime {
protected static function _read_time( $text, $wordsPerPage = 200.00, $decimalPlaces = 2 )
{
$words = str_word_count( strip_tags( $text ) );
$min = floatval( $words ) / $wordsPerPage;
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 / ra-7601U-USB-build-inst.sh
Last active Jul 4, 2018
install ralink 7601U USB N+150 wireless driver (Ubuntu 14.04 or Kernel 3.13+)
View ra-7601U-USB-build-inst.sh
#!/bin/sh
#setup dependencies
sudo apt-get install --reinstall linux-headers-generic build-essential
#get patched drivers
wget http://www.lewiscowles.co.uk/dls/MT7601U-14.04-patched.tar -O - | tar -x
cd MT7601U-14.04-patched
# build and install
@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 / lc-svg-upload.php
Last active Aug 4, 2016
SVG Media Plugin for WordPress (Works since 4.1.2!)
View lc-svg-upload.php
<?php
// Please see https://github.com/Lewiscowles1986/WordPressSVGPlugin from now on
@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>
You can’t perform that action at this time.