Skip to content

Instantly share code, notes, and snippets.

View hSATAC's full-sized avatar
🐈
Cataholic

Ash Wu hSATAC

🐈
Cataholic
View GitHub Profile
@hSATAC
hSATAC / commit-msg
Created February 12, 2014 10:23 — forked from remi/commit-msg
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
// Macro - Set the flag for block completion
#define StartBlock() __block BOOL waitingForBlock = YES
// Macro - Set the flag to stop the loop
#define EndBlock() waitingForBlock = NO
// Macro - Wait and loop until flag is set
#define WaitUntilBlockCompletes() WaitWhile(waitingForBlock)
// Macro - Wait for condition to be NO/false in blocks and asynchronous calls
@hSATAC
hSATAC / gist:7853379
Last active December 30, 2015 16:18
Run vim from go just like `git commit` proof of concept
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
)
var (
@hSATAC
hSATAC / gist:7819876
Created December 6, 2013 07:23
Xcode Clean
#!/usr/bin/env ruby
require 'FileUtils'
derivedDataFolder = Dir.glob(Dir.home + "/Library/Developer/Xcode/DerivedData/*")
moduleCache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf derivedDataFolder + moduleCache
export PS1="\[$(tput bold)\]\[$(tput setaf 3)\]\u\[$(tput setaf 7)\]@\[$(tput setaf 2)\]\h\[$(tput setaf 7)\]:\[$(tput setaf 1)\]\w\[$(tput setaf 6)\] \$(__git_ps1 \"(%s)\")$ \[$(tput sgr0)\]"
@hSATAC
hSATAC / hockeyapp-hipchat-relay.php
Created October 29, 2013 09:32
HockeyApp & HipChat Intergration
<?php
$token = $_GET['auth_token'];
$info = json_decode($HTTP_RAW_POST_DATA, true);
$app_version = $info['app_version'];
$message = urlencode("A new build of <a href='$info[url]'>$app_version[title] #$app_version[version]</a> is just released.");
$room_id = 'xxx';
$endpoint = "https://api.hipchat.com/v1/rooms/message?auth_token=$token&room_id=$room_id&from=HockeyApp&message_format=html&notify=1&color=purple&message=$message";
file_get_contents($endpoint);
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update

The reason why you might get certificate errors in Ruby 2.0 when talking HTTPS is because there isn't a default certificate bundle that OpenSSL (which was used when building Ruby) trusts.

Update: this problem is solved in edge versions of rbenv and RVM.

$ ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"
net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3
  read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

You can work around the issue by installing a certificate bundle that you trust. I trust Mozilla and curl.

---
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:
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Modify by linuz.ly
package main
import (
"bytes"
"fmt"
"code.google.com/p/go.crypto/ssh"