Skip to content

Instantly share code, notes, and snippets.

View p16i's full-sized avatar
💭
TDDing

Pattarawat Chormai p16i

💭
TDDing
View GitHub Profile
@p16i
p16i / latexGitHub.md
Last active October 1, 2019 07:53 — forked from ax3l/latexGitHub
Latex in GitHub Markdown

URLEncode Latex Formula -> [http://meyerweb.com/eric/tools/dencoder/]

Create Link:

![My Formula](http://latex.codecogs.com/gif.latex?<URLEncodedLaTeX>)

or

![My Formula](https://chart.googleapis.com/chart?cht=tx&chl=<URLEncodedLaTeX>)

10 Scala One Liners to Impress Your Friends

Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.

Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.

1. Multiple Each Item in a List by 2

The map function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o

#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@p16i
p16i / 0_reuse_code.js
Created November 15, 2013 20:35
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