This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RingBuffer < Array | |
attr_reader :max_size | |
def initialize(max_size, enum = nil) | |
@max_size = max_size | |
enum.each { |e| self << e } if enum | |
end | |
def <<(el) | |
if @max_size && self.size >= @max_size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails::Application.routes.draw do | |
def api_endpoints | |
controller :api do | |
resources :widget | |
post :register | |
get :help | |
end | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SafariApnController < ApplicationController | |
# When a user allows permission to receive push notifications, a POST request is sent to the following URL: | |
# webServiceURL/version/pushPackages/websitePushID | |
# post '/:version/pushPackages/:website_push_id' => 'safari_apn#package' | |
def package | |
#return the push package | |
send_file(File.join(Rails.root, 'public', 'pushPackage.zip'), type: 'application/zip', disposition: 'inline') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java will use the system SOCKS proxy by default, but it will not bypass the hostnames such as *.local, localhost, 0.0.0.0, etc. | |
The Java PrefPane also does not disable the SOCKS proxy even if you choose "Direct Connection". The best way to disable JAVA from connecting over a Proxy is to set the options with no values: | |
JAVA_OPTS="$JAVA_OPTS -DsocksProxyPort -DsocksProxyHost" | |
thanks to: http://mxw.pl/blog/?p=4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ios7 { | |
-webkit-font-smoothing: antialiased; | |
font-family: 'HelveticaNeue-UltraLight', 'Helvetica Neue UltraLight', 'Helvetica Neue', Arial; | |
background: #3F505E; | |
padding-top: 20px; | |
font-weight: 300; | |
line-height: normal; | |
position: relative; | |
::selection { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run this in the same location as your .xcodeproj file | |
plutil -convert json -r -o - `xcodebuild -showBuildSettings | grep PRODUCT_SETTINGS_PATH | awk -F ' = ' '{print $2}'` | grep CFBundleIdentifier | awk -F ' : ' '{print $2}' | cut -d'"' -f2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* simple API wrapper for Parse Cloud Code and ZeroPush */ | |
ZeroPush = { | |
authToken: 'your-server-auth-token', | |
verifyCredentials: function(){ | |
this.request('GET', '/verify_credentials'); | |
}, | |
register: function(params){ | |
this.request('POST', '/register', params); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#import <PushKit/PushKit.h> | |
@interface AppDelegate : UIResponder <UIApplicationDelegate, PKPushRegistryDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gh --description 'Open the webpage for the current github repo/branch' | |
set -l fetch_url (command git remote --verbose show -n origin ^/dev/null | command grep Fetch | cut -c 14- ) | |
#did we get an exit status? | |
if [ $status -gt 0 ] | |
echo 'Not a git repo.' | |
return 1 | |
end | |
if [ -z $fetch_url ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://jsconsole.com/js/remote.js?snatchev"></script> | |
</head> | |
<body> | |
@snatchev | |
</body> | |
</html> |