Skip to content

Instantly share code, notes, and snippets.

Avatar

Hugues Bernet-Rollande huguesbr

View GitHub Profile
@huguesbr
huguesbr / fix-issue.rb
Last active Aug 29, 2015
Create a branch friendly named after a github issue
View fix-issue.rb
#!/usr/bin/ruby
#
# create a pull request for current branch
#
# configure
# create a github token
# https://github.com/settings/applications#personal-access-tokens
# export GITHUB_TOKEN="xx"
# export GITHUB_USER="huguesbr"
# export GITHUB_REPO="xx/yy" (optional, otherwise use origin url)
@huguesbr
huguesbr / pull-request.rb
Last active Aug 29, 2015
create a pull request based on an issue number
View pull-request.rb
#!/usr/bin/ruby
#
# create a pull request for current branch
#
# configure
# create a github token
# https://github.com/settings/applications#personal-access-tokens
# export GITHUB_TOKEN="xx"
# export GITHUB_USER="huguesbr"
# export GITHUB_REPO="xx/yy" (optional, otherwise use origin url)
@huguesbr
huguesbr / iOSSimDeleteAll.sh
Created Oct 13, 2015
Delete all iOS Simulator
View iOSSimDeleteAll.sh
xcrun simctl list devices | grep -v '^[-=]' | cut -d "(" -f2 | cut -d ")" -f1 | xargs -I {} xcrun simctl delete "{}"
View keen importer.rb
#!/bin/ruby
# import data from keen to keen
# can also delete data from source
require 'keen'
require 'awesome_print'
require 'active_support/core_ext'
require 'i18n'
@huguesbr
huguesbr / gist.sh
Created Mar 9, 2016
update and fix node.js
@huguesbr
huguesbr / generate_csr.sh
Created Mar 9, 2016
Generate a SSL CSR using open ssl
View generate_csr.sh
# generate SSL CSR
openssl req -new -newkey rsa:2048 -nodes -out request.csr -keyout private.key -subj "/C=FR/ST=Region/L=City/O=Company Name/CN=www.domain.com"
@huguesbr
huguesbr / parse_push.sh
Created Mar 9, 2016
Send a Push Notification using Parse Server
View parse_push.sh
curl -X POST \
-H "X-Parse-Application-Id: $PARSE_APP_ID" \
-H "X-Parse-Master-Key: $PARSE_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{
"where": {},
"data": {
"title": "Title",
"alert": "Message"
@huguesbr
huguesbr / XCTestExpectationExtensions.swift
Last active Apr 8, 2016
Simple extension on XCTestExpectation to allow to specify an expectation count. see following test for exemple
View XCTestExpectationExtensions.swift
//
// XCTestExpectationExtensions.swift
//
// Created by Hugues Bernet-Rollande on 7/4/16.
//
import XCTest
extension XCTestExpectation {
private class IntWrapper {
@huguesbr
huguesbr / global_variable_demo.swift
Created Apr 15, 2016
Sample demo of global computed variable and global willSet, didSet methods
View global_variable_demo.swift
import Foundation
var a: Double = 3
var aSquared: Double {
get {
return pow(a, 2)
}
set {
a = sqrt(newValue)
}
@huguesbr
huguesbr / groupedByTests.swift
Last active May 13, 2016
Array groupedBy Extension
View groupedByTests.swift
import Foundation
import XCTest
extension Array {
func groupedByA<Key: Hashable>(mappingClosure: (Element) -> Key?) -> [Key: [Element]] {
return reduce([:]) { (groupedBy, element) in
guard let key = mappingClosure(element) else {
return groupedBy
}
var groupedBy = groupedBy