Skip to content

Instantly share code, notes, and snippets.

@thattimc
thattimc / js-array-cheatsheet.md
Last active October 31, 2021 06:38
Javascript array cheatsheet

Creating an Array

const array = ['one', 'two', 'three'];
or
const array = new Array('one', 'two', 'three');

Get the array index

/** @jsx jsx */
import { jsx } from '@emotion/core';
import { Box } from '@chakra-ui/core';
import PropTypes from 'prop-types';
import React from 'react';
function Template({ children, ...props }) {
return (
<React.Fragment>
@thattimc
thattimc / node-cheatsheet.md
Last active November 25, 2019 12:09
Generate secret key
node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"
zh-HK:
devise:
failure:
invited: "你有一個待處理的邀請, 請接受它以完成創建您的帳戶。"
invitations:
send_instructions: "邀請電子郵件已發送到%{email)。"
invitation_token_invalid: "提供嘅邀請令牌無效!"
updated: "你嘅密碼設置成功。 你而家已經登錄。"
updated_not_active: "你嘅密碼設置成功。"
no_invitations_remaining: "冇剩餘邀請"
@thattimc
thattimc / .gitignore
Created July 25, 2019 10:47
Terraform's gitignore
# Compiled files
*.tfstate
*.tfstate.backup
*.tfstate.lock.info
# logs
*.log
# Directories
.terraform/
@thattimc
thattimc / .editorconfig
Created July 25, 2019 10:42
editorconfig
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
@thattimc
thattimc / model.template.txt
Created June 21, 2019 00:45 — forked from joshuapinter/model.template.txt
Rails Model Template
class [Your Class Here] < ActiveRecord::Base
##################################################################################################
### Attributes ###################################################################################
##################################################################################################
### Constants ####################################################################################
@thattimc
thattimc / revert-a-commit.md
Created January 9, 2019 01:22 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@thattimc
thattimc / _Instructions
Created October 5, 2018 14:53 — forked from benmccallum/_Instructions.md
nuxtjs, vue-bootstrap with custom bootstrap build
1. Install bootstrap as a dev dependency, and its dependencies (node-sass and sass-loader)
`npm install --save-dev [email protected] node-sass sass-loader`
2. Install nuxt plugin of bootstrap vue (includes bootstrap-vue as a dependency)
`npm install @nuxtjs/bootstrap-vue`
3. Register plugin as module in nuxt.config.js (see below)
4. Create app.scss entry point (see below)
# editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true