Skip to content

Instantly share code, notes, and snippets.

View huguesbr's full-sized avatar

Hugues Bernet-Rollande huguesbr

View GitHub Profile
@huguesbr
huguesbr / Reactive.swift
Last active July 29, 2018 07:39
Reactive proxy
//
// Reactive.swift
// RxSwift
//
// Created by Yury Korolev on 5/2/16.
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//
/**
Use `Reactive` proxy as customization point for constrained protocol extensions.
@huguesbr
huguesbr / extension.swift
Created April 6, 2017 10:19
Extension wrapper
// exploration
// add a extension wrapper to any type (like `Reactive` from `RxSwift`)
//: Playground - noun: a place where people can play
import UIKit
struct Extension<Base> {
let base: Base
init(_ base: Base) {
self.base = base
@huguesbr
huguesbr / cbuuid.swift
Last active May 21, 2020 16:01
CBUUID instantiation
extension CBUUID {
var type: UUID {
return UUID(rawValue: uuidString)!
}
enum UUID: String {
case main = "xxx"
@huguesbr
huguesbr / PhotoWriter.swift
Created April 10, 2017 12:44
Photo Writer - Sample Rx wrapper around the global function UIImageWriteToSavedPhotosAlbum
import Foundation
import UIKit
import RxSwift
class PhotoWriter: NSObject {
typealias Callback = (NSError?)->Void
let disposeBag = DisposeBag()
private var callback: Callback
init(callback: @escaping Callback) {
### Keybase proof
I hereby claim:
* I am huguesbr on github.
* I am rompelstilchen (https://keybase.io/rompelstilchen) on keybase.
* I have a public key ASDQjwFy183WMCQdyGvC9Y4nqKpzduv8nitFSnyuCH8W8go
To claim this, I am signing this object:
@huguesbr
huguesbr / delete-channel-messages.js
Created July 27, 2017 08:43 — forked from firatkucuk/delete-slack-messages.js
Deletes slack public/private channel messages.
var https = require('https');
// CONFIGURATION #######################################################################################################
var token = 'SLACK TOKEN';
var channel = 'CHANNEL ID';
var privateChannel = false;
var delay = 300; // delay between delete operations in millisecond
// GLOBALS #############################################################################################################
@huguesbr
huguesbr / prepare-commit-msg
Last active January 12, 2018 08:44
Git hook
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
BRANCH_EXCLUDED=$(printf "%s\n" "${BRANCHES_TO_SKIP[@]}" | grep -c "^$BRANCH_NAME$")
BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1)
$ git diff
diff --git a/app/services/conversation_service.rb b/app/services/conversation_service.rb
index f1dd0faa..f54d3a8d 100644
--- a/app/services/conversation_service.rb
+++ b/app/services/conversation_service.rb
@@ -164,20 +164,19 @@ class ConversationService
send_push_notifications_to_users(recipient, user, conversation, :remove_user)
end
log_action(conversation, :update_out, removed_memberships.map(&:id)) if removed_memberships.any?
+ send_email_notifications(conversation, removed_memberships, :remove)
$ git diff
diff --git a/app/services/conversation_service.rb b/app/services/conversation_service.rb
index f1dd0faa..f54d3a8d 100644
--- a/app/services/conversation_service.rb
+++ b/app/services/conversation_service.rb
@@ -164,20 +164,19 @@ class ConversationService
send_push_notifications_to_users(recipient, user, conversation, :remove_user)
end
log_action(conversation, :update_out, removed_memberships.map(&:id)) if removed_memberships.any?
+ send_email_notifications(conversation, removed_memberships, :remove)
@huguesbr
huguesbr / .bash_profile
Last active July 1, 2019 15:17
adding some rspec custom command
rspec-match() {
# rspec-match blah
# will run all specs matching blah
echo "running specs matching $1"
find spec -wholename "*$1*"| grep -v "factories"| xargs bin/rspec
}
rspec-branch() {
# will run all touches specs edited/created in current branch
current_branch_name=`git branch | grep \* | cut -d ' ' -f2`