Skip to content

Instantly share code, notes, and snippets.

View netbe's full-sized avatar

François Benaiteau netbe

View GitHub Profile

Keybase proof

I hereby claim:

  • I am netbe on github.
  • I am netbe (https://keybase.io/netbe) on keybase.
  • I have a public key ASAg0Au1AyuVXsr2PDi8BAQHnUyDwLGnmoiyEU0QSAmx2go

To claim this, I am signing this object:

Verifying that +fbenaiteau is my blockchain ID. https://onename.com/fbenaiteau
@netbe
netbe / travisci-article-part5.yml
Created October 15, 2015 01:04
travis-ci before_script check if we need to tweet
before_script: bundle exec rake prepare_new_article_tweet
@netbe
netbe / travisci-article-part4.rb
Last active October 15, 2015 01:09
Tweet article if not published
require 'net/http'
desc "Tweet the newly published article"
task :tweet do
if File.exists?(TWEET_FILE)
message = File.read(TWEET_FILE)
puts "Tweeting #{message}"
`bundle exec t update "#{message}" -P .trc`
end
end
@netbe
netbe / travisci-article-part3.rb
Last active October 15, 2015 01:01
Get last Jekyll article's title and url
TWEET_FILE="new-article.txt"
desc "Check if we have a new article and create the message"
task :prepare_new_article_tweet do
title, article_url = last_article
# Check if article already published
uri = URI(article_url)
res = Net::HTTP.get_response(uri)
if res.is_a?(Net::HTTPNotFound)
puts "If successful deployment, we should tweet"
@netbe
netbe / travisci-article-part2.yml
Created October 15, 2015 00:30
snippet 2 for travis ci jekyll twitter article
after_success:
- bundle exec rake tweet_last_article
@netbe
netbe / travisci-article.yml
Created October 15, 2015 00:28
snippet 1 for travis ci jekyll twitter article
mv ~/.trc .
travis encrypt-file .trc --add
git add .trc.enc
mv .trc ~/.trc
@netbe
netbe / main.swift
Created June 5, 2015 16:43
Solution to disable AppDelegate code in swift
import Foundation
import UIKit
func isRunningTests() -> Bool {
let environment = NSProcessInfo.processInfo().environment
if let injectBundle = environment["XCInjectBundle"] as? NSString {
return injectBundle.pathExtension == "xctest"
}
return false
@netbe
netbe / AppDelegate.swift
Created June 5, 2015 16:27
AppDelegate UnitTests Swift
// AppDelegate.swift
import UIKit
func isRunningTests() -> Bool {
let environment = NSProcessInfo.processInfo().environment
if let injectBundle = environment["XCInjectBundle"] as? NSString {
return injectBundle.pathExtension == "xctest"
}
return false
@netbe
netbe / AppDelegate.m
Created June 5, 2015 16:24
AppDelegate Testing ObjC
// AppDelegate.m
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (isRunningTests()) return YES;
// ...
return YES;
}