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
'use strict' | |
const five = require('johnny-five') | |
const board = new five.Board() | |
const robot = require('robotjs') | |
const range = 24 | |
const center = range / 2 | |
const threshold = range / 8 | |
let count = 0 | |
robot.setMouseDelay(1) |
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
const readline = require('readline') | |
const prices = { | |
MAX: 1000, | |
MAC: 1500, | |
MAE: 2000, | |
MAL: 3000, | |
TAX: 2700, | |
TAC: 3900, | |
TAE: 5100 |
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
var Promise, defaultPageSize, paginate; | |
Promise = require('bluebird'); | |
defaultPageSize = 20; | |
paginate = function(knex) { | |
return function(query, paginationOptions, options) { | |
var limit, model, offset, page, pageSize, totalPromise, totalQuery; | |
if (query.fetchAll != null) { |
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
module.exports = { | |
// You can also include other presets | |
presets: ['es2015'], | |
plugins: [ | |
require('babel-plugin-syntax-class-properties'), | |
require('babel-plugin-syntax-decorators'), | |
require('babel-plugin-syntax-object-rest-spread'), | |
// You can pass parameters using an array syntax | |
[ |
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
var presidents = [ | |
{"number":1,"president":"George Washington","birth_year":1732,"death_year":1799,"took_office":"1789-04-30","left_office":"1797-03-04","party":"No Party"}, | |
{"number":2,"president":"John Adams","birth_year":1735,"death_year":1826,"took_office":"1797-03-04","left_office":"1801-03-04","party":"Federalist"}, | |
{"number":3,"president":"Thomas Jefferson","birth_year":1743,"death_year":1826,"took_office":"1801-03-04","left_office":"1809-03-04","party":"Democratic-Republican"}, | |
{"number":4,"president":"James Madison","birth_year":1751,"death_year":1836,"took_office":"1809-03-04","left_office":"1817-03-04","party":"Democratic-Republican"}, | |
{"number":5,"president":"James Monroe","birth_year":1758,"death_year":1831,"took_office":"1817-03-04","left_office":"1825-03-04","party":"Democratic-Republican"}, | |
{"number":6,"president":"John Quincy Adams","birth_year":1767,"death_year":1848,"took_office":"1825-03-04","left_office":"1829-03-04","party":"Democratic-Republican"}, | |
{"number":7,"president": |
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
var presidents = [ | |
{"number":1,"president":"George Washington","birth_year":1732,"death_year":1799,"took_office":"1789-04-30","left_office":"1797-03-04","party":"No Party"}, | |
{"number":2,"president":"John Adams","birth_year":1735,"death_year":1826,"took_office":"1797-03-04","left_office":"1801-03-04","party":"Federalist"}, | |
{"number":3,"president":"Thomas Jefferson","birth_year":1743,"death_year":1826,"took_office":"1801-03-04","left_office":"1809-03-04","party":"Democratic-Republican"}, | |
{"number":4,"president":"James Madison","birth_year":1751,"death_year":1836,"took_office":"1809-03-04","left_office":"1817-03-04","party":"Democratic-Republican"}, | |
{"number":5,"president":"James Monroe","birth_year":1758,"death_year":1831,"took_office":"1817-03-04","left_office":"1825-03-04","party":"Democratic-Republican"}, | |
{"number":6,"president":"John Quincy Adams","birth_year":1767,"death_year":1848,"took_office":"1825-03-04","left_office":"1829-03-04","party":"Democratic-Republican"}, | |
{"number":7,"president": |
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
.mcss .waves-effect,.mcss a{-webkit-tap-highlight-color:transparent}.mcss .picker__table,.mcss table{border-collapse:collapse;border-spacing:0}.mcss{}.mcss .materialize-red{background-color:#e51c23!important}.mcss .materialize-red-text{color:#e51c23!important}.mcss .materialize-red.lighten-5{background-color:#fdeaeb!important}.mcss .materialize-red-text.text-lighten-5{color:#fdeaeb!important}.mcss .materialize-red.lighten-4{background-color:#f8c1c3!important}.mcss .materialize-red-text.text-lighten-4{color:#f8c1c3!important}.mcss .materialize-red.lighten-3{background-color:#f3989b!important}.mcss .materialize-red-text.text-lighten-3{color:#f3989b!important}.mcss .materialize-red.lighten-2{background-color:#ee6e73!important}.mcss .materialize-red-text.text-lighten-2{color:#ee6e73!important}.mcss .materialize-red.lighten-1{background-color:#ea454b!important}.mcss .materialize-red-text.text-lighten-1{color:#ea454b!important}.mcss .materialize-red.darken-1{background-color:#d0181e!important}.mcss .materialize-red |
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
function validate(n){ | |
return n.toString().split('').map(Number).reduceRight(function (prev, digit, index, arr) { | |
if ((arr.length - index) % 2 === 0) { | |
return prev + (digit * 2).toString().split('').map(Number).reduce((a, b) => a + b) | |
} | |
else { | |
return prev + digit | |
} | |
}, 0) % 10 === 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
defmodule Luhn do | |
def validate(num) do | |
digits = Integer.digits(num) | |
len = length digits | |
digits | |
|> Stream.with_index | |
|> Enum.reverse | |
|> Enum.reduce(0, fn {digit, index}, acc -> | |
if rem(len - index, 2) == 0 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
GO_SRC="$GOPATH/src/github.com/prashcr/proxy"; | |
mkdir -p $GO_SRC && | |
protoc -I/usr/local/include -I. \ | |
-I$GOPATH/src \ | |
-I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \ | |
--go_out=Mgoogle/api/annotations.proto=github.com/gengo/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:$GO_SRC \ | |
protos/*.proto && | |
protoc -I/usr/local/include -I. \ | |
-I$GOPATH/src \ | |
-I$GOPATH/src/github.com/gengo/grpc-gateway/third_party/googleapis \ |