Skip to content

Instantly share code, notes, and snippets.

View theotow's full-sized avatar

Manuel Villing theotow

View GitHub Profile
@theotow
theotow / lambda.js
Created November 8, 2018 08:04
lambda.js
const google = require('googleapis').google;
const compute = google.compute('v1');
const rp = require('request-promise');
const md5 = require('md5');
const CONFIG = {
CF_EMAIL: 'john@example.com', // change me
CF_KEY: '<cloudflare_key>', // change me
CF_ACCOUNT_ID: '<cloudflare_account_id>', // change me
CF_NAMESPACE: '<namespace_id>', // change me
@theotow
theotow / lambda.js
Created November 7, 2018 08:24
lambda.js
const google = require('googleapis').google;
const compute = google.compute('v1');
const rp = require('request-promise');
const CONFIG = {
CF_EMAIL: 'john@example.com', // change me
CF_KEY: 'abcde', // change me
CF_ACCOUNT_ID: 'abcde', // change me
CF_NAMESPACE: 'abcde', // change me
G_PROJECT_ID: 'project1', // change me
@theotow
theotow / worker.js
Created November 7, 2018 07:49
worker.js
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getServer(servers) {
const index = getRandomInt(0, servers.length - 1);
let isDone: boolean = false; // bool
let list: number[] = [1, 2, 3]; // array
enum Color {Red = 1, Green = 2, Blue = 4}; // enum with values
enum Color {Red, Green, Blue}; // enum without values
function test(var1?: string, var2: number): number { // var1 is optional, var2 is not, var1 can be null || undefined, and return a number
return 1;
let isDone: boolean = false;
var path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: './app.tsx',
context: path.join(__dirname, '/src'),
output: {
filename: 'bundle.js',
path: path.join(__dirname, 'dist'),
},
@theotow
theotow / SassMeister-input-HTML.html
Created December 29, 2014 06:23
Generated by SassMeister.com.
<div class="bar bar--positive">
<div class="bar__middle"></div>
<div class="bar__content">
<div class="bar__negative"></div>
<div class="bar__positive"></div>
</div>
<div class="bar__footer">
<div class="bar__footer-left">
Negative (0.8)
</div>
.aa{
&__hallo{
color: red;
}
}
@theotow
theotow / SassMeister-input-HTML.html
Created November 10, 2014 22:45
Generated by SassMeister.com.
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,600' rel='stylesheet' type='text/css'>
<main>
<section class="cart">
<div class="cart__top">
<ul class="cart__bubbles">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
@theotow
theotow / SassMeister-input-HTML.html
Created November 10, 2014 22:38
Generated by SassMeister.com.
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,600' rel='stylesheet' type='text/css'>
<main>
<section class="cart">
<div class="cart__top">
<ul class="cart__bubbles">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>