Skip to content

Instantly share code, notes, and snippets.

View chanlito's full-sized avatar
🏠
Working from home

Chanlito chanlito

🏠
Working from home
View GitHub Profile
@tannerlinsley
tannerlinsley / onWindowFocus.ts
Last active January 30, 2024 09:37
A utility function to detect window focusing without false positives from iframe focus events
type State = {
added: boolean;
interval: false | ReturnType<typeof setInterval>;
inFrame: boolean;
callbacks: Array<SetFocusedCallback>;
};
type EnrichedHTMLIFrameElement = HTMLIFrameElement & { ___onWindowFocusHandled: boolean };
type SetFocusedCallback = (focused?: boolean) => void;
@parthdesai93
parthdesai93 / aws_es_connector.js
Last active April 8, 2021 06:18
http-aws-es compatible with new Elasticsearch client.
/* requires AWS creds to be updated.
* if they aren't, update using AWS.config.update() method before instatiing the client.
*
* import this module where you instantiate the client, and simply pass this module as the connection class.
*
* eg:
* const client = new Client({
* node,
* Connection: AwsConnector
* });
@Akryum
Akryum / vue.config.js
Last active April 26, 2020 14:18
Auto-import styles with vue-cli 3
const path = require('path')
module.exports = {
chainWebpack: config => {
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('stylus').oneOf(type)))
},
}
function addStyleResource (rule) {
@francisrod01
francisrod01 / access.log
Last active March 26, 2019 13:20
AWS Beanstalk SSL and renewal with Let's Encrypt Free SSL
172.31.43.189 - - [13/Jan/2018:03:01:56 +0000] "GET / HTTP/1.1" 404 139 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" "191.37.20.2"
172.31.43.189 - - [13/Jan/2018:03:02:03 +0000] "GET / HTTP/1.1" 404 139 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 OPR/50.0.2762.58" "191.37.20.2"
172.31.20.92 - - [13/Jan/2018:03:07:10 +0000] "GET /.well-known/acme-challenge/<my-key-here> HTTP/1.1" 301 185 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" "52.29.173.72"
172.31.20.92 - - [13/Jan/2018:03:07:10 +0000] "GET /.well-known/acme-challenge/<my-key-here> HTTP/1.1" 301 185 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" "34.213.106.112"
172.31.43.189 - - [13/Jan/2018:03:07:10 +0000] "GET /.well-known/acme-challenge/<my-key-here> HTTP/1.1" 301 185 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation se
@seafooler
seafooler / manpath-wrong
Created December 19, 2017 12:52
Fix: "manpath: can't set the locale; make sure $LC_* and $LANG are correct"
## Problem
When login in, the shell prints:
```
manpath: can't set the locale; make sure $LC_* and $LANG are correct
```
## Solution
```
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@SimonSun1988
SimonSun1988 / gist:2ef7db45e46b889783647d941ec15e4d
Created April 12, 2016 03:03
解決 Ubuntu "can’t set the locale; make sure $LC_* and $LANG are correct" 的錯誤
## 安裝語系檔
`$ sudo locale-gen "en_US.UTF-8"`
## 重新設定語系檔
`$ sudo dpkg-reconfigure locales`
## 設定檔