Skip to content

Instantly share code, notes, and snippets.

View tanhauhau's full-sized avatar

Tan Li Hau tanhauhau

View GitHub Profile
@tanhauhau
tanhauhau / .zshrc
Created January 16, 2019 07:12
My zsh theme
# theme customisation
PURE_PROMPT_SYMBOL="🦄"
PURE_CMD_MAX_EXEC_TIME=-1
# lambda-pure theme ftw!
ZSH_THEME="lambda-pure"
@tanhauhau
tanhauhau / index.js
Created December 27, 2018 12:44
Finding dom element within the region
// you can use it to search for offending dom elements that causes and extra space
function findElement(conditionCallback) {
return Array.prototype.slice.call(document.body.querySelectorAll('*')).map(
element => ({ rect: element.getBoundingClientRect(), element })
)
.filter(conditionCallback)
.map(element => element.element);
}
@tanhauhau
tanhauhau / webpack.config.js
Created October 27, 2018 03:02
ascii only for webpack minify config
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
//...
optimization: {
minimizer: new UglifyJsPlugin({
uglifyOptions: {
output: {
// true for `ascii_only`
ascii_only: true
@tanhauhau
tanhauhau / code.js
Created October 24, 2018 08:30
uglify pure code
function foo() {
var a = /*@__PURE__*/foobar();
var b = 8;
return 10;
}
@tanhauhau
tanhauhau / uglified-code.js
Last active October 24, 2018 08:13
Code after uglify-js
function foo(){
foobar();
return 10;
}
@tanhauhau
tanhauhau / code.js
Created October 24, 2018 07:26
Code before uglify-js
function foo() {
var a = foobar();
var b = 8;
return 10;
}
@tanhauhau
tanhauhau / README.md
Created September 26, 2018 04:14
Custom Lambda Pure theme for zsh!

Based on lambda-pure, but added a time based symbol, depending the time of your day!

TIME_BASED_PROMPT_SYMBOL="${PURE_PROMPT_SYMBOL:-λ}"
HOUR_OF_THE_DAY=$(date +"%H")

if [[ HOUR_OF_THE_DAY -eq "12" || HOUR_OF_THE_DAY -eq "13" ]]; then
  # lunch 
  TIME_BASED_PROMPT_SYMBOL="🍚"
elif [[ HOUR_OF_THE_DAY -eq "17" || HOUR_OF_THE_DAY -eq "18" ]]; then
@tanhauhau
tanhauhau / README.md
Created September 26, 2018 03:47
Custom Mattermost Style

Custom Mattermost style, styled with Stylus

Feature

  • Dracula At Night theme
  • Go crazy with H6 tag
  • Shake up and down with the 3 monkeys: 🙈 🙉 🙊
  • Rotate with trollface trollface
@tanhauhau
tanhauhau / config.ts
Created August 30, 2018 10:56
Test Manta Style
interface User {
/**
* @faker {{internet.userName}}
*/
userName: string;
gender: 0;
/**
* @faker date.past
*/
birthday: number;
@tanhauhau
tanhauhau / CustomComponent.js
Created November 16, 2017 15:39
Inducer Example
import React from 'react';
import gameReducer from './gameReducer';
import injectReducer from 'inducer';
class CustomComponent extends React.Component {
// component logic here
}
export default injectReducer({
game: gameReducer
})(CustomComponent);