Skip to content

Instantly share code, notes, and snippets.

View angeloh's full-sized avatar
🎯
Focusing

Angelo Huang angeloh

🎯
Focusing
View GitHub Profile
@gauntface
gauntface / saucelabs-test-examples.js
Last active December 17, 2015 06:28
Example of automated tests on Saucelabs.
// Required Modules
var webdriver = require('wd')
, assert = require('assert')
, fs = require('fs')
, mkdirp = require('mkdirp');
// Define the strings for landscape & portrait
var PORTRAIT = "PORTRAIT";
var LANDSCAPE = "LANDSCAPE";
@visenger
visenger / install_scala_sbt.sh
Last active January 31, 2023 19:10
Scala and sbt installation on ubuntu 12.04
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update
@pankajmi
pankajmi / apns.scala
Created April 30, 2013 11:10
java-apns service
private val service = {
val baseBuilder =
APNS.newService().asPool(maxConnections).
asBatched(batchWaitTimeInSec, maxBatchWaitTimeInSec).
withCert(getClass.getResourceAsStream(certPath), certPassword).
withDelegate(new ApnsDelegate {
override def connectionClosed(e: DeliveryError, messageId: Int) {
logger.error(s"ConnectionClosed MessageID: $messageId Error: $e")
}
override def cacheLengthExceeded(newCacheLength: Int) {
@traviskaufman
traviskaufman / play_framework_testing_async_responses.md
Last active June 8, 2023 09:09
Testing Asynchronous HTTP Responses in Play Framework

Testing Asynchronous Responses in Play! Framework

TL;DR

The Background

I came across this issue while I was working on a functional test for JAMLive!, a Play! application I'm currently working on obsessing over in my free time. I have a controller with a connect method that looks like this:

@huangjs
huangjs / gist:4273403
Created December 13, 2012 01:54
Example code for using FullContact influencer notification in iced-coffee-script on node.js.
# This is example code for influencer notification using FullContact on node.js
# Programming language used here is iced-coffee-script
# Author: Maptia
# License: public domain
_ = require 'underscore'
iced = require('iced-coffee-script').iced
request = require 'request'
fullContactAPIKey = '<your-fullcontact-api-key>'
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@zetachang
zetachang / gist:4111314
Created November 19, 2012 15:37
Instruction on adding a Acknowledgements Settings.bundle
  • To add Settings.bundle in Xcode. Command N and in Resource, choose Settings Bundle .
  • Open Root.plist in source code, paste the code below to replace it,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>PreferenceSpecifiers</key>
	
@nfarina
nfarina / UIView+FrameAdditions.h
Created August 21, 2012 06:40
UIView Frame helper getter/setter category methods
#import <UIKit/UIKit.h>
@interface UIView (SMFrameAdditions)
@property (nonatomic, assign) CGPoint $origin;
@property (nonatomic, assign) CGSize $size;
@property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties
@property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect
@end
@lvbreda
lvbreda / client.js
Created July 31, 2012 22:16
Hacky routing
if (Meteor.is_client) {
var Router = Backbone.Router.extend({
routes: {
"" : "main",
":page": "main" //this will be http://your_domain/
},
main: function(page) {
document.body.innerHTML = "";
page = page?page:"index";
var frag = Meteor.ui.render(function () {
@giates
giates / LICENSE
Created July 17, 2012 18:20
Play framework 2 Unique Constraint using Java/Ebean
Copyright [2012] [Gianluca Tessarolo]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,