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
// http://www.ideashower.com/our_solutions/leastgreatest-common-mulitple-lcmgcm-in-php-and-javascript/ | |
/* Greatest Common Divisor */ | |
Math.gcd = function(a, b) { | |
return ( b == 0 ) ? (a):( Math.gcd(b, a % b) ); | |
}; | |
/* Lowest Common Divisor */ | |
Math.lcd = function(a, b) { | |
return ( a / Math.gcd(a,b) ) * b; |
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 requirejs = require('requirejs'); | |
requirejs.config({ | |
nodeRequire: require | |
}); | |
requirejs(['express', 'connect', 'connect-redis'], function(express, connect, ConnectRedis) { | |
var app = express.createServer(); | |
var RedisStore = new ConnectRedis(express); |
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 f1 = function (a) { | |
return a.map(function (n) { | |
// convert number to decimal reverse the order then left pad it to a byte | |
return String((n).toString(2).split('').reverse().join('') + Array(8 + 1).join("0")).substr(0, 8); | |
}).join('') | |
.split('') | |
.map(function (n) { | |
return +n; // convert each of the numbers to int | |
}); | |
}; |
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 React from 'React'; | |
import {connect} from 'react-redux'; | |
import {populateStore} from 'actions'; // simple action | |
// (state, props) => ({}) | |
// state is the redux store | |
// props is provided to the HigherOrderComponent on line 16 of loadDefaultState.js | |
const mapStateToProps = (state, {initialData}}) => ({ | |
populateStore, | |
initialData, |
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 { Component } from 'react'; | |
class BlahComponent extends Component { | |
constructor(props) { | |
super(props); | |
} | |
switchView = () => { | |
this.setState({ aBoolState: !(this.state.aBoolState)}); |
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
package com.interview.poker.solution; | |
import com.interview.poker.PokerHand; | |
import com.interview.poker.PokerHandEvaluator; | |
import com.interview.poker.card.Card; | |
import com.interview.poker.card.Card.Rank; | |
import java.util.*; | |
/** |
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 bash | |
# OpenVPN configuration Directory | |
OPENVPN_CFG_DIR=/usr/local/etc/openvpn | |
# Directory where EasyRSA outputs the client keys and certificates | |
KEY_DIR=/usr/local/etc/openvpn/certs | |
# Where this script should create the OpenVPN client config files | |
OUTPUT_DIR=/usr/local/etc/openvpn/client-config |
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 path = require("path"); | |
const next = require("next"); | |
const express = require("express"); | |
const { createServer } = require("http"); | |
const { ApolloServer } = require("apollo-server-express"); | |
const helmet = require("helmet"); | |
const { PORT = 3000, NODE_ENV = "dev" } = process.env; | |
const port = parseInt(PORT, 10); |
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
function useForm(callback, defaultValues, schema) { | |
const [values, setValues] = useState({ ...defaultValues }); | |
const [errors, setErrors] = useState([]); | |
const [validateOnChange, setValidateOnChange] = useState(false); | |
async function validate() { | |
if (schema) { | |
const errors = await catchErrors(); | |
if (errors.length > 0) { | |
setErrors([...errors]); |
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
ssh_authorized_keys: | |
- github:pixeldrew | |
k3os: | |
k3s_args: | |
- server | |
- "--no-deploy" | |
- traefik |
OlderNewer