Skip to content

Instantly share code, notes, and snippets.

View awongCM's full-sized avatar
💭
git config --global god-mode on --egoless

Andy Wong Chee Ming awongCM

💭
git config --global god-mode on --egoless
View GitHub Profile
@awongCM
awongCM / macos_build_script.sh
Last active February 20, 2024 11:23
Install and Configure macOS
#### HOMEBREW PACKAGE MANAGER ####
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
brew update
# Oh-my-zsh + this link for more customisation - https://medium.com/crypticcrazeforcs/customising-oh-my-zsh-in-macos-6d4e24ef983
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
@awongCM
awongCM / some_complex_but_useful_css_transitions.css
Last active June 16, 2018 11:57
A collection of CSS animations/transitions I may use
// 1. Text color hover animation (from left to right)
.have-some-text {
/* So far only Chrome webkit browsers can do this.. but this can work for other major browsers too!*/
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-image: linear-gradient(to right, your-secondary-color,
your-secondary-color 50%, your-primary-color 50%);
background-size: 200% 100%;
@awongCM
awongCM / find_overflow_elements_on_page.js
Created February 6, 2018 07:01
Find those pesky unintended body overflow
var doc_width = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll("*"),
function(pesky_el) {
if(pesky_el.offsetWidth > doc_width) {
console.log(pesky_el);
}
}
);
@awongCM
awongCM / reset.rb
Created December 15, 2017 07:50 — forked from seyhunak/reset.rb
Rails - Reset sequence based on ActiveRecord connection adapter
# Interest.destroy_all
case ActiveRecord::Base.connection.adapter_name
when 'SQLite'
update_seq_sql = "update sqlite_sequence set seq = 0 where name = 'interests';"
ActiveRecord::Base.connection.execute(update_seq_sql)
when 'PostgreSQL'
ActiveRecord::Base.connection.reset_pk_sequence!('interests')
when 'Mysql2'
update_seq_sql = "ALTER TABLE interests AUTO_INCREMENT = 1;"
ActiveRecord::Base.connection.execute(update_seq_sql)
@awongCM
awongCM / different_ways_to_put_footer_at_the_bottom_of_page.css
Created June 26, 2017 05:22
Placing footer to the bottom of the page
//1. Object Constructor
var person = new Object();
person.name = "Diego";
person.getName = function(){
return this.name;
};
/*
* The main advantage of this approach is its simplicity.
@awongCM
awongCM / section_tag.md
Last active November 28, 2015 02:52
Best practices with HTML5 section tag
@awongCM
awongCM / mail.rb
Last active November 5, 2015 09:11
SMTP Mail snippet
require 'net/smtp'
#Snippet 1: writing simple using your stmp gmail
message = <<MESSAGE_END
From: Private Person <someone@fromsomemail.com>
To: A Test User <someoneelse@tosomemail.com>
Subject: SMTP e-mail test
This is a test e-mail message.
@awongCM
awongCM / css_resources.md
Last active January 31, 2016 04:46 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.
  • IcoMoon - Tools for generating pixel-perfect icon fonts using SVG/PDF/Sprites.
@awongCM
awongCM / rails_resources.md
Last active August 29, 2015 14:27 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h