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
El Capitan breaks gem install as per http://stackoverflow.com/questions/30812777/cannot-install-cocoa-pods-after-uninstalling-results-in-error/30851030#30851030 | |
Use: | |
sudo gem install -n /usr/local/bin gem-name | |
instead. |
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
// I'm not proud of this but JS has forced my hand | |
function pause(time) { | |
if (typeof time !== "number") { | |
throw("time should be a number in milliseconds"); | |
} | |
var endTime; | |
endTime = (new Date()).getTime() + time; | |
while(1) { | |
var newTime = (new Date()).getTime(); |
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
(y=x=>`(y=${y})()`)() | |
// if you want to alert it: | |
(y=x=>alert(`(y=${y})()`))() |
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
(F=(L,d)=>{(C=d.createElement("canvas")).width=C.height=L;X=C.getContext("2d");for(i=L*L;i--;)X.fillStyle=`rgb(${n=`(F=${F})(16,document)`.charCodeAt(i)||32},${n},${n})`,X.fillRect(i%L,0|(i/L),1,1);d.body.appendChild(C)})(16,document) | |
// After running this code you should be able to grab the pixel values as a Uint8ClampedArray | |
// from the canvas context 'X' and use that to verify like so: | |
var charCodes = Array.from(X.getImageData(0,0,16,16).data).filter((_,i)=>i%4===0) | |
String.fromCharCode.apply(null, charCodes) |
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
R = 1000/10; | |
s = [ | |
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], | |
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], | |
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], | |
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], | |
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
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
data:text/html,<h1>Hello, world! etc. |
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 href="javascript: (function() {/* ... */})();">Bookmarklet</a> |
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
// Not really sure how I feel about this but it's kinda cool... | |
const prettyList = function(list, conjunction) { | |
return list.reduce((acc, str, i, arr) => ( | |
arr.length - i == 1 ? | |
`${acc}${conjunction} "${str}"` : | |
`${acc}"${str}", ` | |
), | |
""); | |
} |
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
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> | |
<!-- https://raw.githubusercontent.com/babel/babel/master/packages/babel-regenerator-runtime/runtime.js --> | |
<script src="http://codepen.io/anon/pen/BKXJKy.js"></script> | |
<ul id="console-outputs"></ul> | |
<form id="console-form"> | |
<input type="text" /> | |
</form> | |
<script> | |
function submitted() { |
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
; Adapted from http://stackoverflow.com/a/13041851/3122246 the way it goes about converting (converts to list of | |
; strings, then to a string then reads the string) is kind of ugly but the code is nice at least. | |
(defn bytes->int [bytes] | |
"Converts a byte array into an integer." | |
(->> | |
bytes | |
(map (partial format "%02x")) | |
(apply (partial str "0x")) | |
read-string)) |