Skip to content

Instantly share code, notes, and snippets.

@admataz
admataz / gist:810d7a1bfeae0130cc43
Last active August 29, 2015 14:22
collected docker commands

create persistent mysql data container run it as a volume to the database:

docker create --name data-container-name -v /var/lib/mysql -p 3306:3306 mysql
docker run -it --name=mysql --volumes-from data-container-name -e MYSQL_ROOT_PASSWORD=123 -p 3306:3306  -d mysql

launch mysql command from host:

@admataz
admataz / gist:0ea2f12708115addc618
Last active August 29, 2015 14:22
Collected cURL commands

POST file contents as attachment to an endpoint

curl -X "POST" -i -F filedata="@test/data/fake_users_api.json" http://localhost:3000/api/v1/users/uploadBulk`
@admataz
admataz / gist:ece2ada06470c43ceace
Created June 5, 2015 20:07
merging passed with default options for javascript functions

As extracted from keystone.js utils

/**
 * Copies and merges options with defaults.
 *
 * @param {Object} defaults
 * @param {Object} options
 * @return {Object} the options argument merged with defaults
@admataz
admataz / gist:e3e196033faf11d5a2b7
Last active August 29, 2015 14:23
gmail search unlabelled mail
-has:userlabels -in:sent -in:chat -in:draft -in:inbox -in:bin
@admataz
admataz / gist:92bc7f98e7b3042f4399
Created June 19, 2015 21:06
markdown URL bookmarklet
function collectWebItemData() {
var webItem = {};
var linkTitle = (document.title);
var linkLocation = (window.location);
var selectedText = '';
if (window.getSelection) {
selectedText = window.getSelection();
} else if (document.getSelection) {
selectedText = document.getSelection();
@admataz
admataz / gist:fcce6d7f3dffbfd060d5
Last active August 29, 2015 14:27
Drush alias for vagrant server
<?php
$aliases['tpzdev'] = array(
'uri' => '192.168.33.10',
'root' => '/var/www/html',
'remote-host' => '192.168.33.10',
'remote-user' => 'vagrant',
'ssh-options' => '-i /path/to/insecure/vagrantvm/private_key'
);
@admataz
admataz / count_group_by.sql
Created August 19, 2015 09:29
select and count group by SQL
select town, count(town)
from user
group by town
@admataz
admataz / gist:02885c976bd601dfa5dc
Last active December 16, 2015 11:53
Notes for 16 December 2015

Some of the more interesting PHP libs emerging

@admataz
admataz / Vagrantfile
Last active December 18, 2015 22:57
Setting up Vagrant dev server for LAMP
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.33"
config.vm.network :forwarded_port, guest: 22, host: 2223, id: 'ssh'
config.vm.provision "shell", path: "./vagrant_setup.sh"
config.vm.synced_folder "./webroot", "/var/www/html", type: "nfs"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.name = "Virtual Dev Server"
end
[xdebug]
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/tmp/xdebug.log"
zend_extension=/usr/lib/php5/20121212/xdebug.so