Skip to content

Instantly share code, notes, and snippets.

View anathematic's full-sized avatar

Thomas anathematic

  • Hobart, Australia
View GitHub Profile
## 1.9.2
# rspec
real 0m27.321s
user 0m24.619s
sys 0m2.417s
# cucumber
real 1m10.722s
user 0m56.713s
sys 0m3.843s
@anathematic
anathematic / Ruby on Rails server config.md
Last active September 26, 2015 22:58
Quick notes for Ruby 2 + postgres on Ubuntu 13.4

Security / user config

Ruby + basic permissions

sudo /usr/sbin/groupadd rvm
sudo /usr/sbin/usermod -a -G wheel,rvm USERNAME 
sudo apt-get install build-essential git-core curl python-software-properties libsasl2-dev mailutils
sudo su -

\curl -L https://get.rvm.io | bash -s stable --ruby

# orders.rb
scope :last_week, lambda { orders.where(purchased_at: 1.week.ago..Time.zone.now) }
# venue.rb
def timeline_summary
[["LW", :last_week], ["LM", :last_month], ["4M", :4_months]].collect do |value|
{ label: value[0]
value: self.orders.send(value[1]).count }
end
end
@anathematic
anathematic / new.html.haml
Last active December 18, 2015 14:59 — forked from nigelr/gist:5801561
%h1 New vendor
= render 'form'
= link_to 'Cancel', vendors_path, id: :cancel_new_vendor_link
---------------------
_form.html.haml
= form_for @vendor, :html => { :class => 'form-horizontal' } do |f|
class ACC.Views.EssentialsAssessment.Index extends Backbone.View
template : JST['programs/essentials_assessments/index']
events : =>
"click [role=next]" : "goToX"
initialize : =>
@model.Videos.on 'reset', @loadViews
render : =>
TravelPrototype::Application.routes.draw do
root to: 'welcome#index'
get "/:page", to: "welcome#page"
end
@anathematic
anathematic / react-testing.md
Last active July 1, 2021 20:49
How I'm testing things in React...

Testing in React w/ Karma, Jasmine and some others...

Testing React kinda sucks, here's some techniques I've used to get the basics done quickly... Basically there's three main ingredients I'm using to do my tests in Karma:

This gives me the basic option to be able to click things in the component based on the ref name. React's test utils do provide it's own selectors for this stuff like Capybara but the API sucks / I found this was easier and more productive.

Example:

Thursday 28th Oct

Breakfast

  • Thomas: Pasta sauce with poached eggs
  • Billie: Vegies

Lunch

  • Sweet potato salad

Keybase proof

I hereby claim:

  • I am anathematic on github.
  • I am anathematic (https://keybase.io/anathematic) on keybase.
  • I have a public key ASCVcple6w9YdbT0a3xG9F_fK_F8kbn0YyyjPShyq6TdjQo

To claim this, I am signing this object: