Skip to content

Instantly share code, notes, and snippets.

View Gerharbo's full-sized avatar

Gerhard Bos Gerharbo

View GitHub Profile
@dkun7944
dkun7944 / UIView+3DFloatingEffect.swift
Last active February 9, 2021 20:19
Extension to add a cool 3D floating effect to any UIView.
extension UIView {
func add3DFloatingEffect(withDepth depth: Double = 1 / 12, duration: Double = 5) {
let depthAngle = depth * .pi
let rotationAnimationY = CABasicAnimation(keyPath: "transform.rotation.y")
rotationAnimationY.fromValue = NSNumber(floatLiteral: -1 * depthAngle)
rotationAnimationY.toValue = NSNumber(floatLiteral: depthAngle)
rotationAnimationY.duration = duration
rotationAnimationY.repeatCount = Float(Int.max)
rotationAnimationY.autoreverses = true
rotationAnimationY.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
@onamfc
onamfc / AccessToken.php
Last active May 9, 2024 13:50
Add Custom Claims to Passport 8 / Laravel 6
<?php
namespace App\Passport;
use App\User;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use League\OAuth2\Server\CryptKey;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use Laravel\Passport\Bridge\AccessToken as BaseToken;
@valfer
valfer / sendPush.txt
Last active April 29, 2024 12:29
Sending Push Notification with HTTP2 (and PHP) see entire post at: http://coding.tabasoft.it/ios/sending-push-notification-with-http2-and-php/
<?php
/**
* @param $http2ch the curl connection
* @param $http2_server the Apple server url
* @param $apple_cert the path to the certificate
* @param $app_bundle_id the app bundle id
* @param $message the payload to send (JSON)
* @param $token the token of the device
* @return mixed the status code (see https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH101-SW18)
class Person {
var name = Observable("John")
}
let person = Person()
person.name.subscribe() { oldValue, newValue in
println("name changed: \(oldValue) to \(newValue)")
}
person.name.value = "Jane"
struct Observable<T> {
typealias ValueType = T
typealias SubscriptionType = Subscription<T>
var value: ValueType {
didSet {
for subscription in subscriptions {
let event = ValueChangeEvent(oldValue, value)
subscription.notify(event)
}
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active May 14, 2024 03:50
Deploy an iOS app to testflight using Travis CI
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global: