Skip to content

Instantly share code, notes, and snippets.

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

NothingRealHappen nothingrealhappen

🏠
Working from home
  • Mars
View GitHub Profile
@nothingrealhappen
nothingrealhappen / sshConfigSample
Created November 18, 2021 08:01
setup ssh key per project
Host github-my-repo
# The host that has the remote Git repository
Hostname github.com
# Username for remote SSH user (For GitHub, everyone uses the name `git`)
User git
# Path to your private SSH key
IdentityFile /root/.ssh/github-my-repo.id.rsa
change repo ssh config from
@nothingrealhappen
nothingrealhappen / README.md
Created October 26, 2021 08:55
Auth0 with nextjs localhost https issue

The problem

Auth0 require https to view your resources safely. But usually our localhost is http rather than https. Generate a custom cert file may solve this issue but it require changes on nextjs/express level.

If you're facing issue like checks.state argument is missing during auth0 login step please continue to read.

The solution

The https reverse proxy

Caddy is an opensource tool for the local https work, not sure if it's safe enough but it's open source. https://caddyserver.com/

@nothingrealhappen
nothingrealhappen / typescriptreact.json
Created June 7, 2021 12:52
Nice snippet for typescript react
{
"useState": {
"prefix": "useState",
"body": ["const [$1, set${1/(.*)/${1:/capitalize}/}] = useState($0);\n"],
"description": "React useState snippet"
}
}
@nothingrealhappen
nothingrealhappen / translate.js
Created October 5, 2020 08:10
translate simplified chinese to traditional chinese
var _ = require('lodash')
var convert = require('chinese_convert')
const data = {
"message": {
"delete": "您要刪除此訪客嗎?"
},
"otherKeys": {
"supportNested": "支持嵌套的字段"
@nothingrealhappen
nothingrealhappen / minxin.scss
Created December 26, 2019 12:02
CSS Multiple line ellipsis issue
.u-text-limit {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
/* autoprefixer: ignore next */
-webkit-box-orient: vertical;
}
.u-text-limit--one {
overflow: hidden;
@nothingrealhappen
nothingrealhappen / cloudSettings
Created July 8, 2019 07:15
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-07-08T07:16:08.252Z","extensionVersion":"v3.3.1"}
@nothingrealhappen
nothingrealhappen / insertAmpImage.elisp
Created June 12, 2019 15:22
Create amp-image shortcode by emacs shortcut
(defun insertAmpImage ()
(interactive)
(
let ((url (read-string "Enter url:")))
(message "detecting")
(insert
(apply 'format
(append
'("
#+begin_export html
@nothingrealhappen
nothingrealhappen / grecreate.bashrc
Last active May 21, 2020 03:25
refresh your branch from master
grecreate() {
branch_name=$(git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3)
git checkout master
git pull --rebase
git branch -D $branch_name
git checkout -b $branch_name
git submodule update
}
gupdate() {
@nothingrealhappen
nothingrealhappen / book-sample.org
Last active January 15, 2019 16:18
org-babel-for-reading-notes

Book info

Reading notes

Favorite quotes

@nothingrealhappen
nothingrealhappen / filter.js
Created May 29, 2018 06:40
Copy jira sprint report tickets content
var result = '';
$('table.aui:eq(0)').find('tr').slice(1).each(function() {
const number = $(this).find('td:eq(0)').html();
const title = $(this).find('td:eq(1)').text();
result += `${number}<br>${title}\r<hr />`;
});
$('body').empty().append(result);