Skip to content

Instantly share code, notes, and snippets.

@tkshnwesper
tkshnwesper / loading-spin.svg
Last active August 29, 2015 14:21
Loading spin (SVG)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tkshnwesper
tkshnwesper / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tkshnwesper
tkshnwesper / Incrementer.php
Last active August 29, 2015 14:23
Incrementer
function getIncrement($str) {
$len = strlen($str);
if($str === '') {
return '0';
}
for($i = $len - 1; $i >= 0; $i--) {
if($str[$i] === '9') {
$str[$i] = 'A';
break;
}
LinkedList<String> list = new LinkedList<>();
@tkshnwesper
tkshnwesper / strshuffle.go
Last active September 21, 2016 15:14
String Shuffle in Go
// StrShuffle shuffles a string that is passed to it
func StrShuffle(str string) string {
n := 25 + rand.Intn(25)
var runes []rune
for _, runeval := range str {
runes = append(runes, runeval)
}
var shuffle = func() bool {
if rand.Intn(2) == 1 {
return true
@tkshnwesper
tkshnwesper / ssl
Last active November 18, 2016 17:02
let's encrypt
listen *:443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/letsencrypt/live/[site_name]/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/[site_name]/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5';
@tkshnwesper
tkshnwesper / op.kt
Created December 25, 2016 20:23
An example of how to use doAsyncResult in Anko
class PopularActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
listView {
id = ViewID.ID_POPULAR_LIST
// This task will happen asynchronously in a separate thread (so you can perform network operations)
@tkshnwesper
tkshnwesper / sql.kt
Created January 22, 2017 16:53
Creating an SQL keyword that does not exist in Anko
db?.createTable("tablename", true,
"id" to INTEGER + PRIMARY_KEY,
"name" to TEXT,
"base" to TEXT,
"lastRead" to object : SqlType {
override val modifier: String?
get() = null
override val name: String
get() = "DATETIME"
}

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 180;
client_max_body_size 0;
sendfile on;
tcp_nodelay on;
gzip off;
upstream droppy {