Skip to content

Instantly share code, notes, and snippets.

mlankenau

Block or report user

Report or block mlankenau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View create_texture.py
from PIL import Image, ImageDraw
# https://github.com/dezhin/osmread
from osmread import parse_file, Way, Node, Relation
points = {}
ways = {}
relations = []
lat_from = 47.7192
View lock.js
// idea, we want to start two async processes a and b.
const a = async () => { do_async_stuff() }
const b = async () => { do_async_stuff() }
// but we need to isolate them. So b should not run before a
const result = Promise.all([a, b])
// this way they can overlap, not good. So lets use a lock
View send_grid.ex
defmodule MailService.SendAdapters.SendGrid do
@mailer_url "https://api.sendgrid.com/v3/mail/send"
@doc """
Send a mail to a list of persons (recipients)
* from from address
* recipients array of email addresses
* subject subject text
View text_file_utils.ex
defmodule TextFileUtils do
def fix_line_breaks(file_path) do
{:ok, file} = File.open(file_path)
out_file_path = "/tmp/fixed_file_#{:erlang.system_time}.tmp"
{:ok, out_file} = File.open(out_file_path, [:write])
process_file(file, out_file, "")
File.close(file)
File.close(out_file)
out_file_path
end
View number_service.exs
defmodule NumberService do
import Plug.Conn
@doc "server loop"
def server(i) do
receive do
{:next, caller} ->
send caller, {:next_num, i}
server(i+1)
end
View task1.ex
defmodule CsvParser do
def main([file | _args]) do
{:ok, file_content} = File.read(file)
parse(file_content)
end
def parse(content) when is_binary(content) do
content
|> String.split("\n")
|> parse
View date_edit.vue
<template>
<div class="datetime-edit">
<input type="text" class="date" name="date"
v-on:change="changed" placeholder="01.01.2017" v-model="dateStr">
<input type="text" class="time" name="date"
v-on:change="changed" placeholder="13:30" v-model="timeStr">
</div>
</template>
<script>
View ant_attack_client.rb
require 'rubygems'
require 'websocket-client-simple'
require 'json'
class Client
LOBBY = "games:lobby"
def initialize
@mode = :lobby
View .tmux.conf
set -g prefix C-a
set -g default-terminal "xterm"
######################
### DESIGN CHANGES ###
######################
# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred
@mlankenau
mlankenau / vue_sample.html
Last active Apr 1, 2016
Vue sample with login and lobby
View vue_sample.html
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.20/vue.js" charset="utf-8">
</script>
</head>
<body>
<template id="login-template">
You can’t perform that action at this time.