Skip to content

Instantly share code, notes, and snippets.

View anathematic's full-sized avatar

Thomas anathematic

View GitHub Profile
@anathematic
anathematic / function.rb
Created February 20, 2020 07:28
A quick wrapper for TDD'ing through Lambda
require 'aws-sdk-core'
require 'aws-sdk'
require 'httparty'
require 'json'
require 'logger'
require 'mail'
def lambda_handler(event:, context:)
logger = Logger.new($stdout)
message = JSON.parse(event['Records'][0]['Sns']['Message'])
@anathematic
anathematic / sup.rb
Last active March 4, 2018 09:24 — forked from KamaKAzii/sup.rb
class Sup
attr_accessor :foo
def not_foo=(foo)
self.foo = foo
end
private
def calc_foo
@anathematic
anathematic / method.rb
Last active August 29, 2017 13:51 — forked from KamaKAzii/method.rb
def self.purchase_as_guest_with_data(data)
s = create_student_from_data(data)
p = create_parent_from_data(data)
s_user = User.new
s_user.contact = s
s_user.email = s.email
s_user.password = data[:student][:password]
p_user = User.new

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:

Thursday 28th Oct

Breakfast

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

Lunch

  • Sweet potato salad
@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:

TravelPrototype::Application.routes.draw do
root to: 'welcome#index'
get "/:page", to: "welcome#page"
end
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 : =>
@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|