Skip to content

Instantly share code, notes, and snippets.

View jt2k's full-sized avatar

Jason Tan jt2k

View GitHub Profile
@jt2k
jt2k / chromeapp.sh
Created August 5, 2015 19:38
Open website in Chrome app mode
#!/bin/bash
chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
url=$1
regex="^https?://"
if [[ ! $url =~ $regex ]]; then
url="http://$url"
fi
<?php
namespace 🏠\🚕;
class 🍎
{
protected $📌;
public function __construct($📌)
{
$this->📌 = $📌;
$('.repository-content, .container').css('width', 'auto');
$('.repository-content').css('float', 'none');
$('.container').css('margin', '0px 20px');
$('.repository-sidebar').hide();
$('.repo-label').css('position', 'static');
@jt2k
jt2k / curltime
Last active October 20, 2016 18:59
#!/bin/sh
curl -L -o /dev/null -s -w " Seconds (cumulative)
Name lookup: %{time_namelookup}
Connect: %{time_connect}
Pre-transfer: %{time_pretransfer}
Start transfer: %{time_starttransfer}
Redirect: %{time_redirect} (if applicable)
=====
Total: %{time_total}
" $1
@jt2k
jt2k / movedock
Last active August 29, 2015 13:56
Change positioning of dock
defaults write com.apple.dock pinning -string start|middle|end
killall Dock
@jt2k
jt2k / why.php
Last active December 31, 2015 09:09
Can someone explain this to me?
<?php
$array = array(0,1,2,3);
foreach ($array as &$val) {
$val = $val + 1;
}
print_r($array);
foreach ($array as $foo) {
echo $foo;
@jt2k
jt2k / convert.php
Created April 11, 2012 17:44
PHP Golf string inverter
<?php
$strings = array(
"\n"
);
if (!isset($argv[1]))
{
die("Please specify an input file\n");
}