Skip to content

Instantly share code, notes, and snippets.

View edwardmp's full-sized avatar

Edward Poot edwardmp

View GitHub Profile
View gist:85a5b9708ae7d29967500e6f91d859ef
require 'faraday' # HTTP Client
require 'faraday-cookie_jar'
require 'faraday_middleware'
require 'fastlane/version'
require 'logger'
require 'spaceship/babosa_fix'
require 'spaceship/helper/net_http_generic_request'
require 'spaceship/helper/plist_middleware'
require 'spaceship/ui'
require 'tmpdir'
View gist:d42b2ecf632e2db9eb823e7a49cbf56c
~ $ fastlane env
[20:15:10]: Generating fastlane environment output, this might take a few seconds...
<details><summary>🚫 fastlane environment 🚫</summary>
### Stack
| Key | Value |
| --------------------------- | ---------------------------------------------------------------- |
| OS | debian_based stretch/sid |
| Ruby | 2.4.0 |
edwardmp /
Last active March 4, 2019 19:51 — forked from brunofacca/
Fix wrong signout path, Devise command

This gist attempts to explain how to implement token authentication in Rails, using Devise and Tiddle. Tiddle was designed to provide token auth for API-only Rails apps. However, the following instructions will enable you to use it in Rails apps which have both APIs and web views.

##Why Tiddle?

Devise is the obvious choice for authentication on Rails. However, token authentication was

edwardmp / bootstrap_errors_for_associations.rb
Last active November 29, 2016 16:52
Automatic bootstrap form validation on *_id fields when validates :association, presence: true is present
View bootstrap_errors_for_associations.rb
BootstrapForm::FormBuilder.class_eval do
def association_object(name)
name = name.to_s
if name.end_with?('_ids')
# Check for a has_(and_belongs_to_)many association (these always use the _ids postfix field).
association = object.class.reflect_on_association(name.chomp('_ids').pluralize.to_sym)
# Check for a belongs_to association with method_name matching the foreign key column
association = object.class.reflect_on_all_associations.find do |a|
edwardmp / examplepayload.json
Created June 24, 2016 19:24
Example APNS payload with ttile
View examplepayload.json
"body":"The status of flight KL123 scheduled 20:30 to London Heathrow has changed to 'boarding'. Boarding at 20:05.",
"title":"Boarding at 20:05"
edwardmp /
Created June 9, 2016 17:20
Example Eclipse JDT AST visitation
package eu.sig.aevas;
import eu.sig.aevas.dependencymanager.maven.MavenDependency;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.*;
edwardmp / exercise.go
Last active September 29, 2023 15:41
A Tour of Go, exercise rot13Reader
View exercise.go
package main
import (
type rot13Reader struct {
r io.Reader
edwardmp / gist:a0ffb3ace02ce4392b26
Created June 13, 2015 15:58
Working example of accepting self-signed SSL certificate in Swift
View gist:a0ffb3ace02ce4392b26
import UIKit
import Foundation
class ViewController: UIViewController, NSURLSessionDelegate {
override func viewDidLoad() {
httpGet(NSMutableURLRequest(URL: NSURL(string: "")!))
edwardmp / gist:817a50d623310f159c88
Created May 22, 2015 16:08
Allow use of self signed SSL certificate when using NSURLSession
View gist:817a50d623310f159c88
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
edwardmp / gist:df8517aa9f1752e73353
Created May 22, 2015 16:06
Using NSURLSession with SSL public key pinning
View gist:df8517aa9f1752e73353
1. Adhere to the NSURLSessionDelegate delegate
2. Initialize NSURLSession and specify self as delegate (e.g. [NSURLSession sessionWithConfiguration:defaultConfigObject delegate:self delegateQueue: [NSOperationQueue mainQueue]];)
3. Add the method below to your class
4. Change the certificate resource name
- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;