Skip to content

Instantly share code, notes, and snippets.

View nombiezinja's full-sized avatar

Ti Zhang nombiezinja

  • Vancouver
View GitHub Profile
@nombiezinja
nombiezinja / sliceIndex.go
Created May 14, 2018 22:21
Get index position of element in slice
package main
import (
"fmt"
)
func main() {
xs := []int{2, 4, 6, 8}
ys := []string{"C", "B", "K", "A"}
fmt.Println(
@nombiezinja
nombiezinja / quickpush.md
Last active April 6, 2018 20:58
Bash script for quick git pushes to current branch

I'm trying to cultivate the habit of more frequent and smaller commits and find typing 3 separate commands super annoying, so I wrote a simple bash script and here's how

  • Set git push to push to your current branch as default if you haven't done so already

git config --global push.default current

  • In your terminal type vim ~/.bashrc (vim ~/.bash_profile for you Mac using folks), at the end of the file put in the following - you can name the short cut whatever you want
function gitpewpew() {
 git add -A
@nombiezinja
nombiezinja / rspec_model_testing_template.rb
Created March 30, 2018 18:58
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@nombiezinja
nombiezinja / aws_day_notes.md
Last active February 22, 2018 01:43
aws_day_notes

Notes: AWS day 2018 - vancouver

EC2

  • AWS availability zones (AZ) -interconnected, fault isolation, each one has 1+ data centers
  • it's VM's
  • resizeable compute capacity, complete control of computing resources
  • scale capacity as requirements change, pay only for capacity you use
  • reliability: desploy across AWS regions and AZ's

Launching an EC2 instance via management console:

#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>
@nombiezinja
nombiezinja / learning-resources.md
Last active October 2, 2018 18:17
Learning resources for web development

A Compilation of Online Resources for Getting Started with Web Development

RSS Feeds and News Letters

Hacker News

Echo JS

ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@nombiezinja
nombiezinja / README.md
Created June 4, 2017 05:02 — forked from hofmannsven/README.md
My simply Git Cheatsheet