Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / README.md
Created January 4, 2010 02:38
imagesLoaded() jquery plugin
@willurd
willurd / web-servers.md
Last active July 22, 2024 15:25
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dingzj
dingzj / deploy-content
Last active May 3, 2017 08:04
content of deploy variable when using custom hook in AWS OpsWorks
before_restart.rb
node[:deploy].each do |application, deploy_item|
run "echo '#{deploy_item.to_json}' >> /tmp/logs.log"
end
## Note only current_path is availabe, no shared_path or release_path
{"home"=>"/home/deploy",
"application_type"=>"rails",
"mounted_at"=>nil,
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@up1
up1 / router.php
Last active August 29, 2015 14:08
Demo :: php router
function logAccess($status = 200) {
file_put_contents("php://stdout", sprintf("custom =>[%s] %s:%s [%s]: %sn",
date("D M j H:i:s Y"), $_SERVER["REMOTE_ADDR"],
$_SERVER["REMOTE_PORT"], $status, $_SERVER["REQUEST_URI"]));
}
@phinze
phinze / main.tf.js
Last active June 14, 2021 23:20
Terraform Example: ebs_block_device that remains after instance termination
resource "aws_instance" "web" {
ami = "ami-7f89a64f"
instance_type = "t1.micro"
ebs_block_device {
device_name = "/dev/sdg"
volume_size = 5
volume_type = "gp2"
delete_on_termination = false
}
}
@winggundamth
winggundamth / docker-compose.yml
Created February 21, 2016 22:18
Sample how to do multi-host overlay networking on swarm with docker compose
version: '2'
services:
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=mypass
- constraint:node==node01
networks:
- backend
@thebinarypenguin
thebinarypenguin / node-hello-world.js
Created March 6, 2016 13:27
"Hello World" HTTP server using node.js
const http = require('http');
const name = 'node-hello-world';
const port = '8888';
const app = new http.Server();
app.on('request', (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('Hello World');
@satyadeepk
satyadeepk / gcloud_install.sh
Last active February 18, 2022 12:21
Jenkins Google Cloud SDK install with auth script
#Ref: https://github.com/circleci/android-cloud-test-lab/blob/master/circle.yml
export DIRECTORY="/var/jenkins_home/GoogleCloudSDK/google-cloud-sdk/bin"
if [ ! -d "$DIRECTORY" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
cd /var/jenkins_home
wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip -O google-cloud-sdk.zip
unzip -o google-cloud-sdk.zip -d ./GoogleCloudSDK/
./GoogleCloudSDK/google-cloud-sdk/install.sh
@anvk
anvk / promises_reduce.js
Last active October 11, 2023 09:02
Sequential execution of Promises using reduce()
function asyncFunc(e) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(e), e * 1000);
});
}
const arr = [1, 2, 3];
let final = [];
function workMyCollection(arr) {