A simple Chrome extension to access hotel.dev (https://github.com/typicode/hotel)
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
var brain = require('brain.js') | |
var net = new brain.NeuralNetwork(); | |
console.log('Generating training data...'); | |
var data = []; | |
for(var i=0; i<100000; i++) { | |
var obj = {}; | |
obj.input = []; | |
obj.input[0] = Math.random(); | |
obj.input[1] = Math.random(); |
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
/* https://twitter.com/Dmitry_Zubkov/status/726555594635808768 */ | |
:root { | |
font-size calc(1vw + 1vh + .5vmin); | |
} | |
body { | |
font 1em/1.6rem sans-serif; | |
} |
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 java.io.*; | |
public class ByteOutputStream extends FileOutputStream { | |
byte buffer; | |
byte pos; | |
public ByteOutputStream(File file) throws FileNotFoundException { | |
super(file); | |
buffer = 0x00; |
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
if(!window.Promise) { | |
var req = new XMLHttpRequest(); | |
req.open('GET', 'https://cdn.polyfill.io/v2/polyfill.min.js?features=Promise', false); | |
req.send(); | |
eval(req.responseText); | |
} |
The challenge states that the image includes shades of gray, #000000 to #F5F5F5. Since all of the pixels are gray, all three bytes of each color will be identical, so only one needs to be considered.
#000000-#F5F5F5 leaves shades 0-245 possible, significantly more than the 50 shades the challenge includes. Dividing these possible shades up evenly, it can be reasonably assumed that each shade is 5 apart.
Next, I wrote a simple Javascript program which would find each possible shade in the image. The shade that is not found is clearly the missing one.
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
#media::before { | |
content: 'desktop'; | |
} | |
@media (max-width: 500px) { | |
#media::before { | |
content: 'mobile'; | |
} | |
} |
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
#!/usr/bin/env osascript -l JavaScript | |
function run(argv) { | |
if(argv.length == 0) { | |
console.log('Usage: of [ transport text ]') | |
} else { | |
Application('OmniFocus').parseTasksInto(Application('OmniFocus').documents[0], { asSingleTask: true, withTransportText: argv.join(' ') }) | |
ObjC.import("stdlib") | |
$.exit(0) | |
} | |
} |
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
img[src$=".svg"] { | |
width: 100%; | |
} |