Skip to content

Instantly share code, notes, and snippets.

View yashke's full-sized avatar
🎯
Focusing

Jan Filipowski yashke

🎯
Focusing
View GitHub Profile
type serializedAccountBalance struct {
AccountId string `json:"accountId"`
BalanceInCents int64 `json:"balanceInCents"`
BalanceCurrency string `json:"balanceCurrency"`
LastDay time.Time `json:"lastDay"`
}
func serializeAccountBalance(accountBalance AccountBalance) (serializedAccountBalance) {
serialized := serializedAccountBalance{}
serialized.AccountId = accountBalance.AccountId
@yashke
yashke / gist.zsh
Last active August 29, 2015 14:08
auth-plain () { printf $1\0\0$2 | base64 | tr -d '\n' | sed 's/^/AUTH PLAIN /' }
@yashke
yashke / Gemfile
Created February 27, 2013 20:46
hexagonal.js Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'sqlite3'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
debug1: Reading configuration data /home/yashke/.ssh/config
debug1: Applying options for ci-market
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to ci-market.arkency.com [176.9.104.102] port 46083.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/yashke/.ssh/id_rsa" as a RSA1 public key
@yashke
yashke / gist:2134480
Created March 20, 2012 12:03
google spreadsheet example
require 'rubygems'
require 'google_spreadsheet'
session = GoogleSpreadsheet.login("jangtugowski@gmail.com", "kakadada")
spreadsheet = session.spreadsheet_by_key("0AlG-njvmBdlJdENlMzlVR3hTYUo1ZGhnck1NSm0yT3c")
ws = spreadsheet.worksheets[0]
ws[1, 1] = "Cześć"
ws[1, 2] = "Czołgiem"
ws.save
describe "SomeUsecase", ->
describe "#execute", ->
beforeEach ->
spyOn(@usecase, 'doSmthWith').andFakeCall(=> null)
it "should pass name parameter as second to callback", ->
@usecase.execute("name")
args = @usecase.doSmthWith.mostRecentCall.args
expect(args[1]).toBe("name")
class ServerSideStub
createToken: (callback) =>
callback("token")
describe "SomeUsecase", ->
beforeEach ->
@serverSide = new ServerSideStub()
@usecase = new SomeUsecase(@serverSide)
describe "#execute", ->
@yashke
yashke / gist:1726615
Created February 3, 2012 00:01
Usecase
class ServerSide
createToken: (callback) =>
# asynchronously get token from server and do:
callback(token)
class SomeUsecase
constructor: (@serverSide) ->
execute: (name) =>
@serverSide.createToken((token) => @doSmthWith(token, name))
36 200 2
37 1150 2
37 7800 3
37 1500 4
data = ServerResponses.initialData
data = merge(data,
player:
points: 10
awarded_prize:
prize:
name: "Better prize"
)