Skip to content

Instantly share code, notes, and snippets.

View devlato's full-sized avatar
🐯
🦜🐨🦘

Denis Tokarev devlato

🐯
🦜🐨🦘
View GitHub Profile
@howlingblast
howlingblast / gist:5814547
Created June 19, 2013 14:00
CoffeeScript: getter/setter example
Function::property = (prop, desc) ->
Object.defineProperty @prototype, prop, desc
class Person
constructor: (@firstName, @lastName) ->
@property 'fullName',
get: -> "#{@firstName} #{@lastName}"
set: (name) -> [@firstName, @lastName] = name.split ' '
p = new Person 'Leroy', 'Jenkins'
@owenallenaz
owenallenaz / caught.js
Last active March 5, 2022 15:30
Showing that nodeJS domains do not catch synchronous errors. Hence the common practice is to enclose them in process.nextTick()
var domain = require("domain");
var d = domain.create();
d.on("error", function() {
console.log("domain caught");
});
try {
d.run(function() {
process.nextTick(function() {
@Stanback
Stanback / nginx.conf
Last active May 31, 2024 13:29 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@rjattrill
rjattrill / multiline-values.yaml
Created November 18, 2013 06:33
Break YAML over multiple lines
# Join multiple lines without new line
value: >
part 1
part 2
# Join with newline
value2: |
line 1
line 2
import tornado.ioloop
import tornado.web
# http://www.tornadoweb.org/en/stable/options.html
from tornado.options import parse_command_line, define, options
define("port", default=8888)
define("debug", default=False)
class MainHandler(tornado.web.RequestHandler):
import tornado.ioloop
import tornado.web
from tornado.options import parse_command_line, define, options
define("port", default=8888)
define("debug", default=False)
class AuthHandler(tornado.web.RequestHandler):
def get(self):
import tornado.ioloop
import tornado.web
from tornado.options import parse_command_line, define, options
define("port", default=8888)
define("debug", default=False)
class AuthHandler(tornado.web.RequestHandler):
def get(self):
import tornado.ioloop
import tornado.web
import tornado.auth
import tornado.gen
from tornado.options import parse_command_line, define, options
define("port", default=8888)
define("debug", default=False)
@branneman
branneman / app.js
Last active February 5, 2021 21:58
Node.js application entry-point files
#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawn;
var args = [
'--harmony',
'app/bootstrap.js'
];
@pfrazee
pfrazee / gist:8949363
Last active August 22, 2023 12:31
In-Application Sandboxing with Web Workers

In-Application Sandboxing with Web Workers

A design rationale.

For the past fews years, the Web has been shifting control to the client. Given the limitations of remote services, developers are now looking for ways to "unhost" static applications – that is, break the dependency on remote servers while still using the Web platform.

One untapped technology for client-side control is the Web Worker Sandbox. This API lets the Page load, execute, and destroy separate Worker threads which use their own Virtual Machines. By using Worker Sandboxes to drive behavior, the Web can give users the choice of which software they run together, shifting development from a centralized SaaS model into a distributed and free (as in freedom) script-sharing model.

Worker Sandboxes can Execute Arbitrary Code