This file contains hidden or 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
/** | |
* Proof of concept ESLint rule for warning about potential | |
* XSS vulnerabilities caused by mixing innerHTML/text node | |
* property access. | |
* | |
* More here: http://benv.ca/2012/10/2/you-are-probably-misusing-DOM-text-methods/ | |
*/ | |
'use strict'; | |
var WARNING_MSG = |
This file contains hidden or 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 Data.Char | |
import Data.Word | |
import Data.Bits | |
import Data.List | |
import Data.Maybe | |
import qualified Data.ByteString as B | |
import Codec.Crypto.AES | |
repeatedKeyXor = do |
This file contains hidden or 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 Data.List (unfoldr) | |
import Data.Tuple (swap) | |
import System.IO (hSetBuffering, stdout, BufferMode(..)) | |
placeValues base = reverse . unfoldr (\x -> if x == 0 then Nothing else Just $ swap $ divMod x base) | |
persistencePath base x = if x < base then [x] else x : (persistencePath base $ product $ placeValues base x) | |
persistence base n = length (persistencePath base n) - 1 | |
lowestNumberSuchThat f = head $ dropWhile (not . f) [0..] | |
main = do |
This file contains hidden or 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
masksOfLength x = iterate (\y -> map (True:) y ++ map (False:) y) [[]] !! x |
This file contains hidden or 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
// ==UserScript== | |
// @name Github Screenshots | |
// @description make a github repo presentable for screenshots | |
// @match https://github.com/* | |
// @version 0.0.1 | |
// ==/UserScript== | |
function hide (node) { | |
node.style.display = 'none'; | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
.meter { | |
width: 300px; | |
height: 50px; | |
border: 1px solid #666; | |
position: relative; |
This file contains hidden or 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
fs = require 'fs' | |
esprima = require 'esprima' | |
escope = require 'escope' | |
eslevels = require 'eslevels' | |
js = (fs.readFileSync './input.js').toString() | |
ast = esprima.parse js, {range: yes} | |
scopes = (escope.analyze ast).scopes |
This file contains hidden or 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
A && B || C && D | |
(A && B) || (C && D) | |
|| | |
/ \ | |
/ \ | |
&& && | |
/ \ / \ | |
A B C D |
This file contains hidden or 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
lRiemann fn a b n | |
| b == a = 0 | |
| b < a = lRiemann fn b a n | |
| n <= 0 = undefined | |
| otherwise = | |
let width = (b - a) / n in | |
let xs = init [a, a + width .. b] in | |
let areas = map (computeArea fn width) xs in | |
sum areas | |
where |
This file contains hidden or 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
" CPSA | |
au BufRead,BufNewFile *.cpsa set ft=cpsa |