Skip to content

Instantly share code, notes, and snippets.

View sean-lin's full-sized avatar

Sean Lin sean-lin

View GitHub Profile
@whatyouhide
whatyouhide / testing_defps.ex
Created January 7, 2016 22:26
Testing private functions in Elixir
defmodule TestDefp do
defmacro __using__(_) do
quote do
import Kernel, except: [defp: 2]
end
end
# Let's redefine `defp/2` so that if MIX_ENV is `test`, the function will be
# defined with `def/2` instead of `defp/2`.
defmacro defp(fun, body) do
@xjdrew
xjdrew / README.md
Last active June 7, 2024 07:15
苹果支付流程

预先说明

目前游戏里面出售的道具,都属于consumable products(消耗性商品),下面的说明流程都是针对这类商品的。别的类型商品处理方法,不完全一样。

注册支付接口回调

app启动的时候即注册支付队列消息的回调者,这个回调者应该是一个单体类,保证在app整个生命周期都存在。ios会回调之前未处理完成的订单。

- (id)init {
    if((self = [super init])) {
        [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
 }
@virtuald
virtuald / sshpass.py
Created December 20, 2014 19:49
Simple python wrapper to give SSH a password for automation purposes (with output capture)
#!/usr/bin/env python3
import os
import sys
_b = sys.version_info[0] < 3 and (lambda x:x) or (lambda x:x.encode('utf-8'))
def ssh_exec_pass(password, args, capture_output=False):
'''
Wrapper around openssh that allows you to send a password to