Skip to content

Instantly share code, notes, and snippets.

View mateeyow's full-sized avatar
🌍

Matthew Torres mateeyow

🌍
View GitHub Profile
@mateeyow
mateeyow / nginx.conf
Last active August 29, 2015 14:17 — forked from turtlesoupy/nginx.conf
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
# Load balancer configuration
upstream exampleApp {
# Directs to the process with least number of connections.
least_conn;
# One failed response will take a server out of circulation for 20 seconds.
server 127.0.0.1:10080 fail_timeout=20s;
#server 127.0.0.1:10081 fail_timeout=20s;
#server 127.0.0.1:10082 fail_timeout=20s;
#server 127.0.0.1:10083 fail_timeout=20s;
@mateeyow
mateeyow / ajax-onleave.js
Last active August 29, 2015 14:22
Send ajax request when someone leaves the page
(function () {
"use strict";
// Do something with the response data
// Since the visitor will leave the page we don't need this
/**
onResponse = function () {
if (httpRequest.readyState == 4) {
if (httpRequest.status === 200) {
// Do something with httpRequest.responseText
@mateeyow
mateeyow / INSTALLING-NODE.md
Last active December 5, 2016 06:51
Installing a better command line tool, and Installing NodeJs on Windows

Installing NodeJs on your Windows Workspace

Install Babun (not necessary but highly recommended)

Babun is an excellent replacement for your cmd; git is also pre-installed.

To install Babun on different directory:

  • Download from this site
  • Exctract the downloaded ZIP file
  • Open cmd
  • Change to the directory of the exctracted ZIP file by doing: cd {{directory_of_the_file}}
/* To add more icons just copy these three lines */
.icon-tomato,
.icon-left-tomato:before,
.icon-right-tomato:after{
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/131442/tomato.svg);
}
@mateeyow
mateeyow / send-mail.php
Created October 7, 2015 03:18
Sending mail function on wordpress
$headers = 'From: Team Pasalubong <no-reply@mypasalubong.com>' . "\r\n";
wp_mail('matthew.torres211@gmail.com', 'Test Mail After Purchase', 'TESTING', $headers);
@mateeyow
mateeyow / docker-compose-install.sh
Created December 2, 2015 04:59 — forked from marszall87/docker-compose-install.sh
Simple script for installing latest Docker Compose on CoreOS >= 717.0.0
#!/bin/bash
mkdir -p /opt/bin
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@mateeyow
mateeyow / trello-css-guide.md
Created January 7, 2016 08:23 — forked from bobbygrace/trello-css-guide.md
Trello CSS Guide

Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

This is where any fun you might have been having ends. Now it’s time to get serious and talk about rules.

Writing CSS is hard. Even if you know all the intricacies of position and float and overflow and z-index, it’s easy to end up with spaghetti code where you need inline styles, !important rules, unused cruft, and general confusion. This guide provides some architecture for writing CSS so it stays clean and ma

@mateeyow
mateeyow / .bash
Created March 30, 2016 07:57
Kubernetes Dev on local
dev_k8s(){
local choice=$1
K8S_VERSION=1.2.0
if [ ! -f /usr/bin/kubectl ] && [ ! -f /usr/local/bin/kubectl ]; then
echo "No kubectl bin exists! Install the bin to continue :)."
return 1
fi
if [[ $choice == "up" ]]; then
@mateeyow
mateeyow / gist:5b31aa0c5ac6a260683e572447a3d917
Created May 5, 2016 08:54 — forked from arun-gupta/gist:4d3e5243dac244dc8c9e8ca07b0c9f2a
Create Docker Swarm with Rescheduling Containers
# Docker Machine for Consul
docker-machine \
create \
-d virtualbox \
consul-machine
# Start Consul
docker $(docker-machine config consul-machine) run -d --restart=always \
-p "8500:8500" \
-h "consul" \