This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from contextlib import contextmanager | |
import numpy as np | |
import torch | |
from torch import Tensor, ByteTensor | |
import torch.nn.functional as F | |
from torch.autograd import Variable | |
import pycuda.driver | |
from pycuda.gl import graphics_map_flags | |
from glumpy import app, gloo, gl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import numpy as np | |
import theano | |
import theano.tensor as T | |
import lasagne as nn | |
import time | |
from PIL import Image | |
from scipy.stats import norm | |
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id=content> | |
<div id=bm-link-container> | |
<p>Bookmarklet <em>(drag this to your bookmarks bar)</em></p> | |
<span id=bm-link></span> | |
</div> | |
<div id=bm-code-container> | |
<p>Bookmarklet Code <em>(processed by babel and URIencoded)</em></p> | |
<textarea id=bm-code readonly></textarea> | |
</div> | |
<div id=bm-source-container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function()%7B%5B...document.querySelectorAll('.usertext-body%20*')%5D.forEach(p%20%3D%3E%5B...p.childNodes%5D.filter(n%20%3D%3E%20n.nodeType%20%3D%3D%3D%203).forEach(n%20%3D%3E%20%7Bconst%20re%20%3D%20%2F%5CS%7B16%2C%7D%2Fg%3Bif%20(re.test(n.nodeValue))%20%7Btry%20%7Blet%20isHtml%2C%20child%3Bconst%20s%20%3D%20n.nodeValue.replace(re%2C%20s%20%3D%3E%20%7Bs%20%3D%20atob(s)%3Bif%20(%2F%5Ehttps%3F%3A%5C%2F%5C%2F%2F.test(s))%20%7Bs%20%3D%20%60%3Ca%20href%3D%22%24%7Bs%7D%22%20target%3D_blank%3E%24%7Bs%7D%3C%2Fa%3E%60%3BisHtml%20%3D%20true%3B%7Dreturn%20s%3B%7D)%3Bif%20(isHtml)%20%7Bconst%20tmp%20%3D%20document.createElement('div')%3Btmp.innerHTML%20%3D%20s%3Bchild%20%3D%20document.createDocumentFragment()%3B%5B...tmp.childNodes%5D.forEach(c%20%3D%3E%20child.append(c))%3B%7D%20else%20%7Bchild%20%3D%20document.createTextNode(s)%3B%7Dp.replaceChild(child%2C%20n)%3B%7D%20catch%20(e)%20%7B%7D%7D%7D))%7D)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
RUN apt-get update | |
RUN apt-get install -y build-essential curl | |
# NodeJS >= 6.0 | |
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - | |
RUN apt-get install -y nodejs | |
# ttfautohint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
let mockingEnabled = false | |
const mocks = {} | |
export function addMock(url, data) { | |
mocks[url] = data | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_toggles = {} | |
makeToggle = (id, fn, delay = 250) => { | |
const elem = document.querySelector('#' + id) | |
elem.onclick = () => { | |
if (_toggles[id]) { | |
clearInterval(_toggles[id]) | |
_toggles[id] = null | |
} else { | |
_toggles[id] = setInterval(() => elem.disabled || fn(), delay) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'bird' | |
.split(/^(.)(.)(.)/) | |
.map(''.constructor.call.bind(''.repeat)) | |
.filter(''.constructor) | |
.map(''.constructor.call.bind(''.charCodeAt)) | |
.map(n=>n<100?100:n<101?107:n<106?111:n) | |
.map(''.constructor.fromCharCode) | |
.join('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This mixin might be used to extend a class with or without its | |
// own "foo" method | |
const mixin = Base => class extends Base { | |
foo() { | |
// Only call super.foo() if it exists! | |
if (super.foo) { | |
super.foo(); | |
} | |
console.log('mixin'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install && npm run build | |
// In output.js, spreadTest(...args) is converted to ES5 | |
function spreadTest(...args) { | |
return args; | |
} | |
console.log(spreadTest(1, 2, 3)); | |
// But the ...args inside of this lib's "audit" function is NOT converted to ES5 | |
import 'react-axe'; |