Skip to content

Instantly share code, notes, and snippets.

View sawthinkar's full-sized avatar
🏞️
In the forest

Saw Thinkar Nay Htoo sawthinkar

🏞️
In the forest
View GitHub Profile
// extract from TELENOR https://ecaf.telenor.com.mm/?orcf=1&lang=my
const townships = [
[
"AhGaYa",
"BaMaNa",
"DaHpaYa",
"HaPaNa",
"HpaKaNa",
"KaMaNa",
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active March 12, 2024 22:46
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@Aetherus
Aetherus / scale-out-phoenix-with-websocket.md
Last active February 23, 2024 14:31
How to scale out a Phoenix application with websocket

How to scale out a Phoenix application with websocket

Foreword

It's relatively easy to scale out stateless web applications. You often only need a reverse proxy. But for those stateful web applications, especially those applications that embeds websocket services in them, it's always a pain to distribute them in a cluster. The traditional way is introducing some external services like Redis to handle pubsub, however, in such way, you often need to change your code. Can Erlang/Elixir, the "concurrency oriented programming languages", best other languages in this use case? Has Phoenix framework already integrated the solution of horizontally scaling websocket? I'll do an experiment to prove (or disprove) that.

Resources

@Lakret
Lakret / gale_shapley.ex
Last active March 1, 2020 18:11
Gale-Shapley stable matching algorithm implementation in Elixir
defmodule StableMatching.Preference do
@enforce_keys [:id, :prefers]
defstruct id: nil, prefers: []
end
defmodule StableMatching.GaleShapley do
alias StableMatching.Preference
@doc """
Solves [stable matching problem](https://en.wikipedia.org/wiki/Stable_marriage_problem#Algorithm)
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active July 24, 2024 07:10
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@bmitch
bmitch / elixir.md
Last active August 31, 2019 05:14
elixir.md
@houtianze
houtianze / on.y.combinator.md
Last active February 27, 2023 12:45
On Y Combinator

Hopefully this may speed your groking of the forking torturing Y Combinator a little bit.

Disclaimer: I don't assert what I say here is accurate, or even correct (I'm not authorative, obviously), but it's my understanding and I'm sharing in the hope that someone who also struggles on the Y Combinator may benefit a tad.

Prerequisite Understandings

  • In Lambda Caculus, everything is a Lambda Caculus (Anonymous function that takes one parameter). And the best thing is that, ... drump roll ..., it's Turing Complete. So theoretically, it can caculate anything a computer can.
  • In this note, I use the term function, which (I think) means Lambda Caculus, to sound (at least to myself) more accustomed.

The definition of Y Combinator

  • Y = λf.(λx.f (x x)) (λx.f (x x))
@alphamu
alphamu / Android Privacy Policy Template
Created February 9, 2017 03:17
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@jlauemoeller
jlauemoeller / phoenix-and-vue-with-brunch.md
Last active July 14, 2020 21:25
Setting up a Basic Phoenix+Vue+Brunch project

Work in Progress: Phoenix + Vue + Brunch

This documents how I integrate Vue 2.0 with Phoenix 1.x using the default brunch pipeline.

The toolchain

Start out by adding the vue-brunch plugin. You will need a version later than 1.2.3 in order to be able to use the extractCSS option (see later). At the time of writing, 1.2.3 was still the version fetched by npm so I suggest just getting the tip of the dev branch for now (this branch is for Vue 2.0 compatibility anyway):

npm install git+https://github.com/nblackburn/vue-brunch.git#dev --save-dev
@dylankbuckley
dylankbuckley / LearnSwiftPartOne.playground
Created September 18, 2016 19:05
Learn Swift 3.0 & Xcode 8 (Part 1 - Swift Basics)
// Basic Operators
35 + 98
62 - 14
50 / 10
463 * 173
// Types
var age: Int = 21 // Int = Integer = Any whole number
var milesCanRun: Double = 0.75 // Double = Float = Decimal Number