Skip to content

Instantly share code, notes, and snippets.

View slacktracer's full-sized avatar

Thiago F slacktracer

  • An island.
View GitHub Profile
@slacktracer
slacktracer / gist:6f190734535de7640b2f
Last active August 29, 2015 14:14
field(player);
Hello, World!
<a
data-ng-click="main.currentView = 'views/other.html'"
href="#"
>
Testing
</a>
//
@slacktracer
slacktracer / messing_with_traits.js_1.js
Created January 26, 2016 04:15
Messing with traits.js
// import importedTrait from 'modules/importedTrait';
const importedTrait = Trait({
direction() {
return this.colours;
}
});
const gameThingTrait = Trait({
// gps: 1337,
render() {
this.fun += 1;
import action from "./controller";
router.get("/:user/status/", authenticate, function(request, response) {
const user = request.params.user;
action(user)
.then(value => response.json(value))
.catch(reason => response.json({ data: reason, status: 500 }));
});
function authenticate(request, response, next) {
'use strict';
const defaultHost = 'localhost';
const defaultPort = 9229;
const defaultPoll = false;
const launchDefaults = false;
const notificationId = 'pollForDevTools';
const interval = 500;
let openedInspectorTab = null;
let notificationActive = false;
<h1>intalg</h1>
<script src="node_modules/intalg/dist/intalg.min.js"></script>
<script>
const intervals = [
{
begin: 19,
end: 31,
type: 'rent'
}
]
const flatten = function flatten(array) {
const flattened = array.reduce(
function reducer(reduced, arrayItem) {
const arrayItemIsArray = Array.isArray(arrayItem);
if (arrayItemIsArray) return reduced.concat(flatten(arrayItem));
const makeG = n => x => (x ** 2 + 1) % n;
const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b));
const pollard = n => {
const g = makeG(n);
let x = 1;
let y = 2;
@slacktracer
slacktracer / context.js
Created January 3, 2018 15:28 — forked from rodrigobranas/context.js
context.js
let context = {};
context.createContext = function (fn) {
let name = "context" + Math.floor(Math.random() * 10000000);
Object.defineProperty(fn, "name", {value: name});
let params = {};
global[name] = params;
fn(params);
delete global[name];
};
@slacktracer
slacktracer / mochainstance.mjs
Created February 18, 2018 19:35 — forked from anonymous/mochainstance.mjs
Mocha ES Modules Example
import Mocha from "mocha"
export default new Mocha()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">