Skip to content

Instantly share code, notes, and snippets.

View ArthurZheng's full-sized avatar
😊

Jun ArthurZheng

😊
  • The Australian Access Federation
  • Melbourne Vic, 3000 Australia
View GitHub Profile
@ArthurZheng
ArthurZheng / Javascript CSS3 Pomodoro Timer.markdown
Created September 14, 2015 03:33
Javascript CSS3 Pomodoro Timer
@ArthurZheng
ArthurZheng / example.md
Created September 20, 2017 01:50 — forked from pcn/example.md
Using jq to get+filter aws data

I've been playing with jq, and I've been having a hard time finding examples of how it works with output from a service like AWS (which I use a lot).

Here is one I use a lot with vagrant-ec2.

When we're launching and killing a lot of instances, the AWS API is the only way to track down which instances are live, ready, dead, etc.

To find instances that are tagged with e.g. {"Key" = "Name", "Value" = "Web-00'} in the middle of a vagrant dev cycle, or a prod launch/replace cycle, you can do something like this:

require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@ArthurZheng
ArthurZheng / rspec_model_testing_template.rb
Created December 4, 2017 05:30 — forked from SabretWoW/rspec_model_testing_template.rb
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:
@ArthurZheng
ArthurZheng / composing-software.md
Created January 30, 2019 10:33 — forked from rosario/composing-software.md
Eric Elliott's Composing Software Series
### My publicly-auditable identity:
https://keybase.io/junzheng
### From the command line:
Consider the [keybase command line program](https://keybase.io/download).
```bash
# look me up
### My publicly-auditable identity:
https://keybase.io/junzheng
### From the command line:
Consider the [keybase command line program](https://keybase.io/download).
```bash
# look me up
### Keybase proof
I hereby claim:
* I am arthurzheng on github.
* I am junzheng (https://keybase.io/junzheng) on keybase.
* I have a public key ASDs8uwYMxtEo7NBLw4nfLYMSrHfeyYnAJGfCdpHUUWTogo
To claim this, I am signing this object:
"""
A TestRunner for use with the Python unit testing framework. It
generates a tabular report to show the result at a glance.
The simplest way to use this is to invoke its main method. E.g.
import unittest
import TestRunner
... define your tests ...
@ArthurZheng
ArthurZheng / git-cleanup
Created January 30, 2020 22:01 — forked from yakovkhalinsky/git-cleanup
Prune local GIT branches that are merged into origin master
git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d