Skip to content

Instantly share code, notes, and snippets.

View adrian7's full-sized avatar
🦉
cărturar și filozof

Adrian Şilimon-Morariu adrian7

🦉
cărturar și filozof
View GitHub Profile
#!/usr/bin/env bash
# Example of supporting long (--long) and short (-s) options in bash via getopts
# Shorg options are declared at the beginning of the while block,
# while their counterparts (long options) are declared in the case block
# If the option requires a value, it should be declared as r: (letter followd by colon)
# and validated with needs_arg() when parsing.
# Alternatively die "Error message" is used to stop when we get an option which has not been declared
#!/usr/bin/env bash
curl -s -D - "$1" -o /dev/null
@adrian7
adrian7 / code-coverage-daylight.css
Created March 14, 2018 17:29
PHPUnit Code Coverage Daylight Style
/**
* PHPUnit Code Coverage Daylight Style
* Makes coverage pages more readable
*/
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro');
body {
padding-top: 10px;
background: #f1f1f1;
@adrian7
adrian7 / fonts.scss
Created February 5, 2018 11:13 — forked from bradonomics/fonts.scss
Whitney & Sentinel Fonts CSS File (base64)
@font-face {
font-family: "Whitney SSm SC A";
src: url(data:application/x-font-woff;base64,d09GRk9UVE8AACSFAA0AAAAAN7gAAQAAAAAiXAAAAikAAAaRAAAAAAAAAABDRkYgAAAIzAAAFOgAABjhSw4xdkdERUYAAB20AAAAHQAAACAApQAER1BPUwAAHdQAAALQAAALHqpjoC9HU1VCAAAgpAAAAFoAAACA6dotXU9TLzIAAAGMAAAATwAAAGBZHFc/Y21hcAAABmgAAAJOAAADoIQ7xnlnYXNwAAAhAAAAAAgAAAAIAAAAC2hlYWQAAAEwAAAANAAAADYC7N5yaGhlYQAAAWQAAAAgAAAAJAd+A49obXR4AAAhCAAAAVMAAAHg/fogQW1heHAAAAGEAAAABgAAAAYAeFAAbmFtZQAAAdwAAASKAAALyqV9lZxwb3N0AAAIuAAAABMAAAAg/7gAMnjaY2BkYGBgZHC8dFVtYTy/zVcGbuYXQBGGC5y+JTD6/9X/KszPmB2AXA4GJpAoAGwsDKh42mNgZGBgPvBfgIGBRf//1f/XmZ8xAEVQQAUAoQcHEwAAUAAAeAAAeNpjYGKSYXRlYGVgYdrD1MXAwNADoRnvMhgx/GJAAgsZmP47MDBEw/geas75QEpZUYlZ4b8FwwnmAwwfgPz5IDkmIaarDApAyAQAvV8O/gB42rVUTW/bRhAdWXJsJ7ET+5jTNA2MpJBkyVBiK6eiBgznGhsJAvRQilqJdEQusVxaYZFD7+2xhx7yO3ruD+hP6I/p2+G6puJEcYFWhLhvZ+fjvZkFiehR43dqUPX7Fv8KN+hr7Cq8QmsUetykr+jc41bNZ5U26WePb+HkN4/XaEIfPF6nzcaKxxs1fHtlu3HP4zu002SP79bwZs1ni75p7nt8v8Zhu4Z3BDep0drA7qfm9x436Lj5l8crtNV66HGTvmv1PG7VfFbpQct4fIvWW794vEZ/tn71e
@adrian7
adrian7 / gist:ff8b7fa3dccb8b85b1bdc1af40de8fec
Created February 3, 2017 10:58 — forked from jcsrb/gist:1081548
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
@adrian7
adrian7 / runlocal.sh
Last active February 11, 2017 14:22
runlocal - Build & run local environments (alternative to eb local run)
#!/usr/bin/env bash
###########################################################################################
# runlocal - Build & run a local environment using docker (alternative to eb local run) #
# Also cleans up containers and images built; #
# #
# usage: runlocal <path> [options...] #
# #
# @author: adrian7 <adrian.silimon.eu> #
# @version: 1.1 #
@adrian7
adrian7 / requestbin.php
Created July 8, 2016 09:56
HTTP Request Bin
<?php
/**
* RequestBin - Captures and displays HTTP requests
* @author adrian7
* @version 1.1
*/
//TODO (1) Parse request data in a nice way
//TODO (2) Alternative nice display alongside raw
@adrian7
adrian7 / singleton.js
Created April 18, 2016 13:25
Javascript singleton
var Singleton = (function() {
var random = ( "My Private Random Int = " + parseInt(1000 * Math.random()) );
var privateVar = "My Private Variable";
function privateMethod () {
return ( "My privateMethod()\n" + privateVar );
}

26 time management hacks I wish I'd known at 20

  1. There's always time. Time is priorities
  2. Days always fill up | "Only plan for 4-5 hours of real work per day."
  3. Work more when you're in the zone. Relax when you're not. | "It's normal to have days where you just can't work and days where you'll work 12 hours straight"
  4. Respect your time and make it respected | "Your time is $1000/hour, and you need to act accordingly"
  5. Stop multi-tasking. It merely kills your focus.
  6. Set up a work routine and stick to it. Your body will adapt
  7. We're always more focused and productive with limited time.
  8. Work is the best way to get working. Start with short tasks to get the ball rolling.
@adrian7
adrian7 / php-transfer-vars.sh
Created February 10, 2016 16:38
Copies environment variables strarting with prefixes_ to php-fpm pool.conf file
### Append Container variables to PHP-FPM pool configuration ###
PHP5_CONFIG_FILE=/etc/php5/fpm/pool.d/www.conf
echo "" >> $PHP5_CONFIG_FILE;
echo ";container environment variables" >> $PHP5_CONFIG_FILE;
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")