Skip to content

Instantly share code, notes, and snippets.

View gyandeeps's full-sized avatar

Gyandeep Singh gyandeeps

View GitHub Profile
@jpsoroulas
jpsoroulas / q-promises-examples.js
Last active November 20, 2018 21:36
Basic examples of promises using the Q library
'use strict';
var Q = require('q');
/*
Here are some basic examples of promises using the Q library https://github.com/kriskowal/q).
To run a specific scenario, install an execution environment and uncomment the respective
method call (runScenarioX()).
The code is tested using node.js v0.12.7 (https://nodejs.org/en/) and Q v1.4.1 library
(https://www.npmjs.com/package/q).
*/
@jayj
jayj / flexbox.less
Last active June 23, 2024 01:14
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@m14t
m14t / fix_github_https_repo.sh
Created July 5, 2012 21:57
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
@btoone
btoone / curl.md
Last active November 3, 2024 23:34
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@kentbrew
kentbrew / node-on-ec2-port-80.md
Last active November 14, 2024 11:23
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);