Skip to content

Instantly share code, notes, and snippets.

View AkarshSatija's full-sized avatar
:octocat:

Akarsh Satija AkarshSatija

:octocat:
View GitHub Profile
//In console
$(".user-actions.btn-group.not-following button.user-actions-follow-button").each(function(index,value) {
console.log(index)
})
@AkarshSatija
AkarshSatija / closure in loop
Created March 14, 2015 04:31
closure in loop javascript
//closure in loop
var funcs = [];
var ret=[];
var flag=0;
function exec4(){console.log("exec4")}
for (var i = 0; i < 3; i++) {
funcs[i] = (function(index) {
return function() {
@AkarshSatija
AkarshSatija / gist:c12bfaa16f444e73f488
Created April 2, 2015 06:32
//closure in loop eg 2
//closure in loop
var funcs = [];
var ret=[];
var flag=0;
function exec4(){console.log("exec4")}
for (var i = 0; i < 3; i++) {
funcs[i] = (function(index) {
return function() {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
@AkarshSatija
AkarshSatija / getWeek.js
Last active August 29, 2015 14:22 — forked from dblock/getWeek.js
Get the week Number of the year
function( d ) {
// Create a copy of this date object
var target = new Date(d.valueOf());
// ISO week date weeks start on monday
// so correct the day number
var dayNr = (d.getDay() + 6) % 7;
// Set the target to the thursday of this week so the
@AkarshSatija
AkarshSatija / curl.md
Last active August 29, 2015 14:22 — forked from btoone/curl.md

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
@AkarshSatija
AkarshSatija / gist:7037787
Created October 18, 2013 07:33
list of groups
$ getent group group_name
error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
ini_set('display_errors',1);
@AkarshSatija
AkarshSatija / nginx config
Created March 8, 2016 11:18
nginx config
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
@AkarshSatija
AkarshSatija / Problem and how to solve with closure
Last active April 25, 2016 17:46
Problem with asyncronous calls
function tryIt() {
var sheets = {
"1": {
"name": "type1",
"marker": "http://www.google.com/mapfiles/markerA.png"
},
"2": {
"name": "type2",
"marker": "http://www.google.com/mapfiles/markerB.png"
},