Skip to content

Instantly share code, notes, and snippets.

@davepoon
davepoon / docker helper function
Created February 26, 2017 03:20
docker helper function
To clear containers:
docker rm -f $(docker ps -a -q)
To clear images:
docker rmi -f $(docker images -a -q)
To clear volumes:
docker volume rm $(docker volume ls -q)
To clear networks:
@davepoon
davepoon / install_node
Created August 16, 2016 13:53
Install Latest Nodejs on Amazon Linux/CentOS
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -
yum install nodejs
@davepoon
davepoon / install-nodejs-amazon-ec2-centos
Created August 16, 2016 10:47 — forked from douglascorrea/install-nodejs-amazon-ec2-centos
Install NodeJS on Amazon Linux EC2 (CentOS)
sudo yum install openssl openssl-devel
sudo yum groupinstall "Development Tools"
sudo yum install git-core
git clone [email protected]:nodejs/node.git
cd node
./configure
make
@davepoon
davepoon / gist:1f50ec3f8de8445537a407f267c70c61
Created August 16, 2016 00:48 — forked from mikepfeiffer/gist:4d9386afdcceaf29493a
EC2 UserData script to install CodeDeploy agent
#!/bin/bash
yum install -y aws-cli
cd /home/ec2-user/
aws s3 cp 's3://aws-codedeploy-us-east-1/latest/codedeploy-agent.noarch.rpm' . --region us-east-1
yum -y install codedeploy-agent.noarch.rpm
@davepoon
davepoon / Binding to methods of React class
Created May 25, 2016 01:39
A quick way of binding to methods of React class
constructor() {
for (const methodName of [
'yourMethod1',
'yourMethod2',
'yourMethod3',
]) { this[methodName] = this[methodName].bind(this); }
}
@davepoon
davepoon / Pass props to {this.props.children}
Created May 23, 2016 04:58
Pass props to {this.props.children}
// instead of this.props.children, we use the following syntax to pass props to children components
{React.cloneElement(this.props.children, this.props)}
@davepoon
davepoon / Copy ssh key to clipboard
Created March 3, 2015 05:12
Copy ssh key to clipboard
pbcopy < ~/.ssh/id_rsa.pub
@davepoon
davepoon / Delete all the untagged images
Created March 3, 2015 00:58
Delete all the untagged images
docker rmi `docker images -q --filter "dangling=true"`
/*
* Grid Overlay for Twitter Bootstrap
* Assumes a 1.692em baseline grid (22px/13px)
*/
@media (min-width: 1200px) {
body {
background: -webkit-gradient(linear, top left, bottom left, color-stop(0%, rgba(0, 0, 0, 0.05)), color-stop(4.545%, rgba(0, 0, 0, 0.05)), color-stop(4.545%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, top left, top right, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(35%, rgba(0, 0, 0, 0)), color-stop(35%, rgba(0, 0, 0, 0.05)), color-stop(36%, rgba(0, 0, 0, 0.05)), color-stop(36%, rgba(0, 0, 0, 0)), color-stop(65%, rgba(0, 0, 0, 0)), color-stop(65%, rgba(0, 0, 0, 0.05)), color-stop(66%, rgba(0, 0, 0, 0.05)), color-stop(66%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0))), -webkit-gradient(linear, top left, top right, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(0%, rgba(0, 0, 0, 0.1)), color-stop(0.085%, rgba(0, 0, 0, 0.1)), color-stop(0.085%, rgba(0, 0, 0, 0)));
background: -webkit-linear-gradient(90deg, rgba(0, 0, 0, 0.05), rgba(
@davepoon
davepoon / gist:4743527
Created February 9, 2013 02:14
Set the ownership of htdoc to www-data user and group, it's been set to vagrant user and group by default.
config.vm.share_folder("www", "/var/www", "~/www", :owner => "www-data", :group => "www-data")