This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From: https://github.com/stavro/arc/blob/master/README.md#url-generation | |
Avatar.url({"selfie.png", user}, :thumb, signed: true, expires_in: 3600) | |
#=> "https://bucket.s3.amazonaws.com/uploads/1/thumb.png?AWSAccessKeyId=AKAAIPDF14AAX7XQ&Signature=5PzIbSgD1V2vPLj%2B4WLRSFQ5M%3D&Expires=1434395458" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2020-04-24", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"s3:PutObject", | |
"s3:GetObject", | |
"s3:DeleteObject" | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
CURRENT_NAME="CurrentName" | |
CURRENT_OTP="current_name" | |
NEW_NAME="NewName" | |
NEW_OTP="new_name" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sendActions(with player: Player) { | |
WebSocket.instance.sendMessage(with: "game:slimeSoccer", | |
event: "playerAction", | |
payload: [ | |
"player" : player.id, | |
"jump": player.isJumping, | |
"left": player.isMovingLeft, | |
"right": player.isMovingRight, | |
"x": player.sprite?.position.x as Any, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func sendMessage(with channelId: String, | |
event: String, | |
payload: Socket.Payload, | |
onSuccess: @escaping (Socket.Payload) -> (), | |
onError: @escaping (Socket.Payload) -> ()) { | |
guard let socket = socket else { return } | |
if socket.isConnected { | |
socket.channels[channelId]?.send(event, payload: payload)? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func joinChannel(with channelId: String, | |
payload: Socket.Payload, | |
channelEventListeners: [ChannelEventListener], | |
onJoinSuccess: @escaping (Socket.Payload) -> (), | |
onJoinError: @escaping (Socket.Payload) -> ()) { | |
guard let socket = socket else { return } | |
let joinChannelBlock: () -> () = {[weak self] in | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func connectSocket() { | |
WebSocket.instance.setup(with: "http://192.168.1.146:4000/socket/websocket") | |
WebSocket.instance.connect(with: {[weak self] in | |
guard | |
let weakSelf = self | |
else { return } | |
WebSocket.instance.joinChannel(with: "game:slimeSoccer", | |
payload: ["email":"[email protected]"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func connect(with onConnect: @escaping () -> (), retryOnDisconnect: Bool = true) { | |
guard let socket = socket else { return } | |
self.retryOnDisconnect = retryOnDisconnect | |
socket.onConnect = onConnect | |
socket.onDisconnect = {[weak self] error in | |
guard let weakSelf = self else { return } |