Skip to content

Instantly share code, notes, and snippets.

View magicly's full-sized avatar

magicly magicly

View GitHub Profile
const bushu = (n, arr) => {
if (n < 10) return;
if (n > 10000000) return;
let newArr = [];
for (let i = 1; i <= n; i++) {
if (arr.indexOf(i) == -1) {
newArr.push(i);
}
}
return newArr;
(base) ➜ my_app cat x.js
setTimeout(()=>{
console.log('timer1')
Promise.resolve().then(function() {
console.log('promise1')
})
})
setTimeout(()=>{
@magicly
magicly / min-char-rnn.py
Last active December 4, 2018 14:04 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
all_names = set(data.split("\n"))
chars = list(set(data))
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>CORS</title>
<style>
button {
font-size: 5rem;
margin-bottom: 1rem;
var http = require('http');
var url = require('url');
http.createServer(server).listen(1337, '127.0.0.1');
var qs = require('querystring');
var WHITE_LIST = new Set(["http://127.0.0.1:63342", "http://localhost:63342"]);
function server(request, response) {
var req = request;
@magicly
magicly / scalacheckppt
Created June 1, 2015 07:40
intro to scalacheck
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="property-based testing, scalacheck, scala, java, unit testing, jUnit" />
<meta name="description" content="Property-based testing with ScalaCheck." />
<title>Remark</title>
<style type="text/css">
@import url(http://fonts.googleapis.com/css?family=Droid+Serif);
@import url(http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@magicly
magicly / IndexPlusPlusTest.java
Created December 15, 2014 05:10
why not n == 10
package concurrent;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Created by magicalli on 2014/12/13.
*/
public class IndexPlusPlusTest {
private volatile static int n = 0;
private static int m = 0;