Skip to content

Instantly share code, notes, and snippets.

View astranavt's full-sized avatar
🌴
On vacation

Anton astranavt

🌴
On vacation
View GitHub Profile
@hufyhang
hufyhang / forEach.js
Created December 27, 2015 15:33
JavaScript Array.prototype.forEach Polyfill
/*
* forEach Polyfill
*
* 2015-12-27
*
* By Feifei Hang, http://feifeihang.info
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
'use strict';
@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@githiro
githiro / gist:5819142
Created June 19, 2013 23:45
JS: forEach polyfill
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fn, scope)
{
for(var i = 0, len = this.length; i < len; ++i)
{
fn.call(scope, this[i], i, this);
}
}
}
@realmyst
realmyst / gist:1262561
Created October 4, 2011 19:34
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#