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
/** | |
* @param {number} x | |
* @return {number} | |
*/ | |
var reverse = function(x) { | |
let y = 0; | |
let num = Math.abs(x); | |
const intMax = Math.pow(2, 31) + 1; | |
while(num != 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
// Not the fastest thing in the world | |
export default class Middleware { | |
constructor (methods) { | |
this.methods = methods; | |
this.methodsStack = {}; | |
this.originalMethod = {}; | |
methods.forEach (method => { | |
this.methodsStack[method] = []; | |
this.originalMethod[method] = this[method]; |
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
const splitTotal = (total, n) => { | |
let arr = []; | |
let i = 0; | |
while (i < n) { | |
arr.push(Math.floor(Math.random() * total) + 1) | |
i++; | |
} | |
const sorted = [0].concat(arr, [total]).sort((a, b) => a - b); | |
let out = []; |
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
const fs = require('fs'); | |
const solc = require('solc'); | |
const Web3 = require('web3'); | |
// Connect to local Ethereum node | |
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); | |
// Compile the source code | |
const input = fs.readFileSync('Token.sol'); | |
const output = solc.compile(input.toString(), 1); |
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 matplotlib.pyplot as plt | |
from keras.models import Sequential | |
from keras.layers import Dense | |
from keras.optimizers import Adam | |
model = Sequential() | |
model.add(Dense(10, input_dim=X_train.shape[1], activation='sigmoid')) | |
model.add(Dense(1, activation='sigmoid')) | |
model.compile(optimizer=Adam(lr=0.01), | |
loss='binary_crossentropy', |
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
def nn(X, y, hiddenLayerSize=10, learningRate=0.01, epochs=100, debug=False): | |
m = X.shape[1] | |
outputSize = y.shape[1] | |
# Make our model | |
model = dict( | |
w0 = np.random.randn(m, hiddenLayerSize), | |
w1 = np.random.randn(hiddenLayerSize, outputSize) | |
) | |
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 numpy as np | |
import pandas as pd | |
np.random.seed(1) | |
# train comes from the titantic dataset provided by | |
# kaggle (https://www.kaggle.com/c/titanic/data) | |
df = pd.read_csv('./data/titanic-train.csv') | |
def preprocess(raw_data): | |
# Preprocess 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
Verifying my Blockstack ID is secured with the address 14xYsyu9E2KocyoSUpByuJ6qZ7RSy3WcAv https://explorer.blockstack.org/address/14xYsyu9E2KocyoSUpByuJ6qZ7RSy3WcAv |
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
module.exports = function container_plugin(md, name, options) { | |
function validateDefault(params) { | |
return true; | |
// return params.trim().split(' ', 2)[0] === name; | |
} | |
function renderDefault(tokens, idx, _options, env, self) { | |
// add a class to the opening tag | |
if (tokens[idx].nesting === 1) { | |
tokens[idx].attrPush(['class', `${name} ignore-me`]); |
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
.demo { | |
position: relative; | |
} | |
.demo .notificationsFrame { | |
z-index: 2; | |
width: 100%; | |
top: 20px; | |
background: #fff; | |
border-radius: 3px; | |
overflow: hidden; |