Skip to content

Instantly share code, notes, and snippets.

@kurko
kurko / gist:560ccaf4df5207f10193
Created October 20, 2015 05:35
Spine Swift 2 state
Ld /Users/kurko/Library/Developer/Xcode/DerivedData/Dinero-frfqupqfiefqgtevsufnmfrmbtcl/Build/Products/Debug-iphonesimulator/Spine.framework/Spine normal x86_64
cd /Users/kurko/www/ios/Dinero/Pods
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode7.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode7.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode7.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -L/Users/kurko/Library/Developer/Xcode/DerivedData/Dinero-frfqupqfiefqgtevsufnmfrmbtcl/Build/Products/Debug-iphonesimulator -F/Users/kurko/Library/Developer/Xcode/DerivedData/Dinero-frfqupqfiefqgtevsufnmfrmbtcl/Build/Products/Debug-iphonesimulator -filelist /Users/kurko/Library/Developer/Xcode/DerivedData/Dinero-frfqu
# Given
# /auth/:section_token/?redirect_url=:redirection_with_token/?option=:option
entity = Instructor.find(5)
# this is a token that expires
confirmation_token = TokenModel.new_for_entity(
entity_id: entity.token,
type: :confirmation
)
@kurko
kurko / gist:af8676d5c67e356704e5
Last active September 21, 2015 04:32
OMG I HATE SPRING
(2.2.0p0, Rails 4.2.0) ~/src/app (production↓)
→ git status
On branch production
Your branch is behind 'origin/production' by 26 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Gemfile.lock
diff --cc lib/active_model/serializer/adapter/json_api.rb
index f604b67,cd8de8e..0000000
--- a/lib/active_model/serializer/adapter/json_api.rb
+++ b/lib/active_model/serializer/adapter/json_api.rb
@@@ -16,18 -17,19 +17,33 @@@ module ActiveMode
end
def serializable_hash(options = {})
+ @root = (@options[:root] || serializer.json_key.to_s.pluralize).to_sym
+
@kurko
kurko / gist:c6b905280882a4639e95
Created September 6, 2014 22:33
Dynamic vs static

Dynamically typed vs statically typed

# Example 1
def order(user, shipping_method, cart)
  # ...
end

Tell Don't Ask

class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
#protect_from_forgery with: :exception
before_action :set_headers
def set_headers
headers["Endpoint-Purpose"] = "point_of_sale"
if Rails.env.development?
@kurko
kurko / gist:10024698
Last active August 29, 2015 13:58
Jenkins vs SemaphoreApp vs TravisCI

Jenkins is the name of server we use right. SemaphoreApp is the service which we'd like to use instead.

Newer project:

Test Semaphore Jenkins TravisCI CircleCI
Master 2:08 5:28 3:42 1:59
Integration 2:23 7:45 5:05 2:30
@kurko
kurko / gist:9664123
Created March 20, 2014 13:49
How to: Stories and communication

Communication

Here are some good practices about communication within an Agile project.

TL;DR about stories

There are some general rules about stories. A story:

  • can't be started if it's not estimated
  • can't be estimated if it's not clear enough
@kurko
kurko / _README.md
Last active January 1, 2016 04:38
Ember.js - Writing contract tests for your Ember Data models

Ember.js Testing package was a great addition to the project. It allowed us to have fast specs to guarantee the defined behavior. However, there's no convention on how you should guarantee that your models, the heart of any Ember.js application, are valid in relation to your backend.

Put another way, if you have an User model with a name attribute, how can you be sure that your backend is still responding with {"user": {"name": "Your Name"}}? So, even though your acceptance specs pass, you're stubbing out your models with FIXTURES.

Most people either manually test their apps or create an end-to-end test with the backend server, which is slow as hell (think of Capybara). The good news is that there are conventions for solving this since like forever. One way to guarantee this integrity is via Contract tests (http://martinfowler.com/bliki/IntegrationContractTest.html). Basically, you have a test to guarantee your models are matching your backend.

Using server-side end-to-end tests have many drawbacks,