Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Arjunkumar tk120404

🎯
Focusing
View GitHub Profile
@aescarcha
aescarcha / nodeAsyncTest.js
Created Sep 25, 2018
Javascript async / await resolving promises at the same time test
View nodeAsyncTest.js
// Simple gist to test parallel promise resolution when using async / await
function promiseWait(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(true);
}, time);
});
}
@geoffleyland
geoffleyland / ortools_vrp_4_depots_14_stops.cpp
Last active Feb 7, 2019
Ortools RoutingModel not finding best solution to a VRP in a 14-node example
View ortools_vrp_4_depots_14_stops.cpp
#include "or_tools_route.h"
#include "ortools/constraint_solver/routing.h"
#include <vector>
#include <cstdio>
using operations_research::RoutingModel;
#define DEPOT_COUNT 4#include "or_tools_route.h"
#include "ortools/constraint_solver/routing.h"
@uorat
uorat / nginx-websocket-proxy.conf
Last active Jun 29, 2022
Nginx Reverse Proxy for WebSocket
View nginx-websocket-proxy.conf
upstream websocket {
server localhost:3000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/websocket.access.log main;
View gist:bdd583401eca26a16a34
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/j/vendor/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/j/vendor/underscore-min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/latest/clappr.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/bemtv/alpha/p2phls.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://cdn.clappr.io/bemtv/latest/p2phlsstats.min.js"></script>
<title>Globo Media Control Test Page</title>
@staltz
staltz / introrx.md
Last active Jul 3, 2022
The introduction to Reactive Programming you've been missing
View introrx.md
@demisx
demisx / angularjs-providers-explained.md
Last active May 12, 2022
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
View angularjs-providers-explained.md
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active Jun 28, 2022
JS: AngularJS Directive Attribute Binding Explanation
View angularjs_directive_attribute_explanation.md

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

@tk120404
tk120404 / india.js
Last active Oct 4, 2016
Prints India Map as shown below in the india.txt node india.js
View india.js
var a,b=0,c=10,qwer ="TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBLOFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm SOn TNn ULo0ULo#ULo-WHq!WFs XDt!";
while ((a = qwer.charCodeAt(b++)) != 0) {
while (a-- > 64) {
require('sys').print( ++c==90 ? String.fromCharCode(c = c/ 9):String.fromCharCode(33^b&1));
}
}
//Source : http://codepad.org/ngiITeZ4
@paulirish
paulirish / gist:4158604
Created Nov 28, 2012
Learn JavaScript concepts with recent DevTools features
View gist:4158604

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.

Closures

Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

@domenic
domenic / promises.md
Last active Jun 22, 2022
You're Missing the Point of Promises
View promises.md

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.