Skip to content

Instantly share code, notes, and snippets.

View TerryFunggg's full-sized avatar
🛌
writing dummy code

Terry Funggg TerryFunggg

🛌
writing dummy code
View GitHub Profile
@TerryFunggg
TerryFunggg / read.md
Created May 19, 2023 07:09
M1/M2 using Chruby with Rubymine
From the "Ruby SDK + Gems" click + and select "Version Manager"
hit cmd+shift+. so Finder shows all directories (otherwise /opt may not be visible).
Navigate to /opt/homebrew/share/chruby/, select the chruby.sh file and click "OK"
You should now be able to select a chruby rubies from the window
@TerryFunggg
TerryFunggg / User.php
Created October 19, 2021 09:31
Simple php model
<?php
class Customer
{
private $id;
private $fields;
public function __construct()
{
$this->id = null;
@TerryFunggg
TerryFunggg / insert_record.rb
Created August 31, 2021 09:58
sample of ruby request post api
require 'faker'
require 'net/http'
require 'json'
# static data
def createFakeData()
api_entry = "<Your API Entry>"
# Fake data
@TerryFunggg
TerryFunggg / ffmeg.md
Created June 8, 2021 14:28
how to use ffmpeg to record video

Recode video screen size 1366x768, rate 25, audio input by default, Output video call output.mkv

ffmpeg -video_size 1366x768 -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i default output.mkv
@TerryFunggg
TerryFunggg / finder.sh
Created May 26, 2021 02:12
fzf find file and open it
finder(){
du -a $1 | awk '{print $2}' | fzf | xargs -r $EDITOR
}
# Usage:
# finder {folder}
# eg: finder .config
@TerryFunggg
TerryFunggg / swapper
Created May 17, 2021 15:10
script that swap the esc key and capslock key
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
# usage
# xmodmap ~/.swapper

Keymaps

change content quickly

let say you are doing web development:

<a href="www.google.com">link</a>

we want to change the google link to github link. we use h j k l move to href, and then press "v" to select the google link, press "c" to change it to 'www.github.com" Instead, we can just type below at the line any position

c i "
@TerryFunggg
TerryFunggg / sample_redux.js
Last active April 10, 2021 10:12
simple example of how redux works
import {createStore} from 'redux';
// STORE -> GLOBALIZED STATE
// ACTION
// like restaurant menu
const increment = () => {
return {
type: 'INCREMENT'
}
@TerryFunggg
TerryFunggg / mysql_cheat_sheet.md
Last active February 21, 2021 14:49 — forked from bradtraversy/mysql_cheat_sheet.md
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@TerryFunggg
TerryFunggg / fun_javascript.js
Created February 15, 2021 15:58
writing javascript in fun way 1
exports.validateRegister = async (ctx, next) => {
const data = ctx.req.body;
const e = (data) => !!data.email && isEmail(data.email);
const p = (data) => !!data.password;
const n = (data) => !!data.name;
const checks = [e, p, n];
const isPass = (check) => check(data);