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
class Color { | |
rgbToHex (r, g, b) { | |
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); | |
} | |
hexToRgb (hex) { | |
let arr = hex.slice(1).match(/.{1,2}/g); | |
return [parseInt(arr[0], 16), parseInt(arr[1], 16), parseInt(arr[2], 16)]; | |
} | |
} |
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
// THE BATTLEFIELD GRID | |
// ['top left', 'top middle', 'top right', | |
// 'middle left', 'center', 'middle right', | |
// 'bottom left', 'bottom middle', 'bottom right'] | |
// | |
function fire(x,y) { | |
var xArray = ['left', 'middle', 'right'], | |
yArray = ['top', 'middle', 'bottom']; | |
return ((x == 1 && y == 1) ? 'center' : yArray[y] + ' ' + xArray[x]); |
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
String.prototype.toBase64 = function() { | |
return new Buffer(this.toString()).toString('base64'); | |
}; | |
String.prototype.fromBase64 = function() { | |
return new Buffer(this.toString(), 'base64').toString('utf8'); | |
}; |
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 findSum () { | |
var sum = 0; | |
arguments.__proto__ = Array.prototype; | |
for (val of arguments) { | |
if (val < 0) return -1; | |
sum += val; | |
} | |
return sum; | |
} |
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 Round (n) { | |
return Number(`${Math.round(`${n}e${2}`)}e-${2}`).toString(); | |
} |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 { | |
class Program { | |
static void Main(string[] args) { |
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 creational | |
import ( | |
"errors" | |
"fmt" | |
) | |
const ( | |
LuxuryCarType = 1 | |
CarFactoryType = 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
#!/bin/sh | |
# enable fail-fast | |
set -e | |
# enable trace | |
set -x | |
CONSUL_IP="xxxxxxx" | |
CONSUL_BASE_URL="http://${CONSUL_IP}:8500/v1" |
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
version: '2' | |
services: | |
# MongoDB: https://hub.docker.com/_/mongo/ | |
mongodb: | |
image: mongo:3 | |
volumes: | |
- mongo_data:/data/db | |
# Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html | |
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.6.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 'package:flutter/material.dart'; | |
import 'package:english_words/english_words.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Startup Name Generator', |
OlderNewer