Skip to content

Instantly share code, notes, and snippets.

@hamchapman
hamchapman / export.js
Created October 16, 2018 16:36
Chatkit data export using Node SDK
var Chatkit = require('../target/index');
var fs = require('fs');
// var PusherPlatform = require('../node_modules/pusher-platform-node/target/index');
// Just for local testing where using self signed certs
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
// const baseClient = new PusherPlatform.BaseClient({
// host: 'localhost',
@hamchapman
hamchapman / chatkit-github-oauth-server.js
Created September 3, 2018 09:12
Chatkit GitHub OAuth server
const server = require('server')
const fetch = require('node-fetch')
const Chatkit = require('pusher-chatkit-server')
const { get, post } = server.router
const { json, header, status, redirect } = server.reply
const credentials = require('./credentials.json')
const chatkit = new Chatkit.default(credentials)
@hamchapman
hamchapman / chatkitdelete.js
Created January 5, 2018 10:53
deleting a chatkit user
const chatkit = new Chatkit.default({
instanceLocator: "YOUR_INSTANCE_LOCATOR",
key: "YOUR_KEY"
});
const userId = 'YOUR_USER_ID';
// this returns the user as expected
chatkit.getUsersByIds([userId])
.then((res) => {

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@hamchapman
hamchapman / pusherDisconnectDelegateSwift
Created March 27, 2015 16:07
pusher disconnect delegate in swift
//
// ViewController.swift
// PusherTest
//
// Created by Hamilton Chapman on 21/10/2014.
// Copyright (c) 2014 Pusher. All rights reserved.
//
import UIKit
@hamchapman
hamchapman / swift-ws
Created January 9, 2015 11:45
Swift websockets
import UIKit
class ViewController: UIViewController {
let wSock = wSocket(key: "afa4d38348f89ba9c398")
override func viewDidLoad() {
super.viewDidLoad()
var ch = wSock.subscribe("test-channel")
ch.bind("test-event", { (data: JSON) -> Void in
@hamchapman
hamchapman / cp_problems_more
Created July 24, 2014 11:06
touch a.txt; sudo dtruss -f sudo -u $USER cp a.txt b.txt
PID/THRD SYSCALL(args) = return
33272/0x2697e7: getsid(0x0, 0x110000D, 0xFBD00) = 32838 0
33272/0x2697e7: getgroups(0x0, 0x0, 0x0) = 13 0
33272/0x2697e7: getgroups(0xD, 0x7F9CC1E00380, 0x0) = 13 0
33272/0x2697e7: seteuid(0x0, 0x7F9CC1E00380, 0x0) = 0 0
33272/0x2697e7: setuid(0x0, 0x7F9CC1E00380, 0x0) = 0 0
33272/0x2697e7: setegid(0x0, 0x7F9CC1E00380, 0x0) = 0 0
33272/0x2697e7: seteuid(0x0, 0x7F9CC1E00380, 0x0) = 0 0
33272/0x2697e7: open_nocancel(".\0", 0x0, 0x1) = 3 0
33272/0x2697e7: fstat64(0x3, 0x7FFF53C1A770, 0x0) = 0 0
@hamchapman
hamchapman / cp_problems
Created July 24, 2014 10:59
touch test; sudo dtruss -f sudo -u $USER cp test test3
PID/THRD SYSCALL(args) = return
32264/0x2657e0: thread_selfid(0x0, 0x1DC0, 0x7FFF65F69550) = 2512864 0
32264/0x2657e0: csops(0x0, 0x0, 0x7FFF513C91C4) = 0 0
32264/0x2657e0: issetugid(0x0, 0x0, 0x0) = 0 0
32264/0x2657e0: shared_region_check_np(0x7FFF513C70F8, 0x10E836000, 0x4) = 0 0
32264/0x2657e0: getpid(0x1, 0x10E899000, 0x49656E69) = 32264 0
32264/0x2657e0: __mac_syscall(0x7FFF8D4F2E47, 0x2, 0x7FFF513C8888) = 0 0
32264/0x2657e0: stat64("/AppleInternal\0", 0x7FFF513C8908, 0x0) = -1 Err#2
32264/0x2657e0: audit_session_self(0x7FFF513C87C0, 0x7FFF513C85F8, 0x4) = 4099 0
32264/0x2657e0: geteuid(0x7FFF513C87C0, 0x7FFF513C85F8, 0x0) = 0 0
@hamchapman
hamchapman / lcp_homescreen
Created May 25, 2014 11:44
Launch Center Pro action to save last photo saved and create a Day One entry with it and tag it #homescreen
launch://x-callback-url/clipboard?attach=photo:last&x-success={{dayone://post?entry=%23homescreen&imageClipboard=1}}
@hamchapman
hamchapman / wunderlist_login
Last active January 4, 2016 00:39
Trying to make login work using Wunderlist API
payload = { email: "hamchapman@example.com", password: "cheeseburgers" }.to_json
req = Net::HTTP::Post.new uri
req.body = payload
req.add_field "Content-Type", "application/json"
response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.ssl_version = :SSLv3
http.request(req)