Skip to content

Instantly share code, notes, and snippets.

View royling's full-sized avatar
🔬
Keep practicing and learning everyday!

Roy Ling royling

🔬
Keep practicing and learning everyday!
View GitHub Profile
@royling
royling / tmux-iterm2.md
Last active April 24, 2023 19:35
tmux in iTerm2 cheatsheet
@royling
royling / socks_proxy.sh
Last active October 9, 2016 08:53
Turn your Mac/Linux host to a SOCKS server in one cmd
#!/bin/bash
# try to kill existing process
ps aux | awk '/[s]sh -D 7070/ {print $2}' | xargs kill
# delay 1s
sleep 1
# start SOCKS proxy
ssh -D 7070 -fN user@host
@JonCatmull
JonCatmull / file-size.pipe.ts
Last active April 14, 2024 14:27
Angular2 + TypeScript file size Pipe/Filter. Convert bytes into largest possible unit. e.g. 1024 => 1 KB
/**
* @license
* Copyright (c) 2019 Jonathan Catmull.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@WebReflection
WebReflection / multiple-uploads.md
Last active June 30, 2021 14:12
Uploading multiple files at once, and without jQuery

The aim of this gist is to fix the following informative post about uploading via XHR.

Fixing the HTML

The first part is the HTML. First of all, you really don't need JavaScript to upload a file but you do need a proper form. Secondly, inputs in a form shouild have a name, because the name is what the server will receive: not IDs, names!

Following the fixed form part.

@btroncone
btroncone / rxjs_operators_by_example.md
Last active March 30, 2025 21:26
RxJS 5 Operators By Example
@btroncone
btroncone / ngrxintro.md
Last active July 5, 2025 14:15
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@MichalZalecki
MichalZalecki / index.js
Created March 12, 2016 12:24
How to import RxJS 5
// Import all
import Rx from "rxjs/Rx";
Rx.Observable
.interval(200)
.take(9)
.map(x => x + "!!!")
.bufferCount(2)
.subscribe(::console.log);
@royling
royling / index.html
Last active February 25, 2016 02:03
CSS blending
<!DOCTYPE html>
<head>
<title>CSS Blending</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div>
<input id="backdropColor" type="text" placeholder="Backdrop color, eg. #ffffff/white"><br>
<input id="sourceColor" type="text" placeholder="Source color, eg. #000000/black"><br>
<select name="blendingMode" id="blendingMode"></select>
@royling
royling / bashrc
Created October 18, 2015 09:39
bashrc
alias ls='ls -aGFh'
alias ll='ls -l'
git_repo() {
git rev-parse --is-inside-work-tree &> /dev/null
return $?
}
git_branch() {
git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
@royling
royling / gitr
Last active March 6, 2025 03:16
run git command in multiple repositories
#! /bin/bash
CWD=`pwd`
printUsage() {
echo "gitr - Git for multiple repositories made easy!"
echo -e "Usage: gitr <branch|status|push|pull|fetch|merge|stash|checkout [options] [arguments]> [--repos <repo>...] [--gitr-base <path>]"
}
println() {
echo "$1"