Skip to content

Instantly share code, notes, and snippets.

View Evgenus's full-sized avatar
🇺🇦
Ukraine

Eugene Chernyshov Evgenus

🇺🇦
Ukraine
View GitHub Profile
@Evgenus
Evgenus / gist:11125030
Last active August 29, 2015 14:00
simple js jail
<!DOCTYPE html>
<html>
<head>
<script id="user-code" type="text">
debugger;
</script>
<script type="text/javascript">
(function() {
Connected!
["auth", [], {"id": "USER-04ce8c53b6144bcc8f57d982b0496f4b"}]
>["nodeCreated", ["XXX"], {"rev": 0}]
["createNode", ["XXX"], {"rev": 0, "origin": 0}]
["changePorts", ["XXX", []], {"rev": 1}]
["changeState", ["XXX", {"__type__": "Root", "path": null}], {"rev": 2}]
>["nodeStateChanged", ["XXX", {"path": "."}], {"rev": 1}]
["createNode", ["NODE-6f00f8c1ff804b80a72cd247c49e449a"], {"rev": 3}]
["changeState", ["NODE-6f00f8c1ff804b80a72cd247c49e449a", {"__type__": "File", "path": ".\\client_vanilla.html"}], {"rev": 4}]
["changePorts", ["NODE-6f00f8c1ff804b80a72cd247c49e449a", [{"name": "in", "title": ""}]], {"rev": 5}]
describe 'Building module with unknown dependency', ->
base = ->
before ->
@old_cwd = process.cwd()
process.chdir("/")
it 'should report unresolved dependency', ->
builder = spa.Builder.from_config("/testimonial/spa.yaml")

Явное указание зависимостей

Вариант 1

Указание порядка загрузки модулей которые делают какое-то непотребство (портят window).

depends:
    <rule1>: <rule2>
                     |  NTVS  |  TSLS

-------------------------|--------|--------- Show command | + | - Specify building options | - | + Wraps npm | + | - Generate AMD | - | + Generate CJS | + | + Use node_modules | + | -
Clean sollution [1] | + | - Valid import system [2] | + | -

                       |  NTVS  |  TSLS

---------------------------|--------|--------- Show compiler command line | + | - Specify building options | - | + Wraps npm | + | - Generate AMD | - | + Generate CJS | + | + Use node_modules | + | -
Clean sollution [1] | + | - Valid import system [2] | + | -

@Evgenus
Evgenus / coffee
Created July 2, 2014 11:37
Cakefile
fs = require("fs")
path = require("path")
coffee = require("coffee-script")
uglify = require("uglify-js")
mkdirpSync = require('mkdirp').sync
sass = require('node-sass')
walker = require('fs-walk-glob-rules')
{exec} = require('child_process')
minify = (source) ->
@Evgenus
Evgenus / test.html
Created July 3, 2014 20:02
SJCL hash performance test
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://bitwiseshiftleft.github.io/sjcl/sjcl.js"></script>
<script type="text/javascript">
var c, i, q, sjcl, _i, _j;
c = "7";
@Evgenus
Evgenus / cypher.coffee
Created July 4, 2014 17:28
sjcl cypher
sjcl = require("../bower_components/sjcl/sjcl.js")
decrypt = (ciphertext, password, p) ->
salt = sjcl.codec.hex.toBits(p.salt)
iv = sjcl.codec.hex.toBits(p.iv)
ct = sjcl.codec.bytes.toBits(ciphertext)
key = sjcl.misc.pbkdf2(password, salt, p.iter).slice(0, p.ks / 32)
prp = new sjcl.cipher[p.cipher](key)
text = sjcl.mode[p.mode].decrypt(prp, ct, iv, p.auth, p.ts)
return sjcl.codec.utf8String.fromBits(text)
@Evgenus
Evgenus / test.ts
Created August 28, 2014 12:31
Cross mixin references
class EventEmitter {
public fire(): void {
}
}
//-----------------------------------------------------------------
interface ICanFire {
fire(): void;
}