This file contains 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 Cocoa | |
// for-in | |
func checkForIn(array: [Int], dict: [Int: String]) { | |
for num in array where dict[num] != nil { | |
num | |
} | |
} | |
checkForIn([1,2,3,4], dict: [1:"one", 2:"two"]) |
This file contains 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
StringRequest request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() { | |
@Override | |
public void onResponse(String s) { | |
///handle response from service | |
}, new ErrorResponse() { | |
@Override | |
public void onErrorResponse(VolleyError volleyError) { | |
//handle error response | |
} | |
}) { |
This file contains 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/sh | |
BOOT2DOCKER_CERTS_DIR=/var/lib/boot2docker/certs | |
CERTS_DIR=/etc/ssl/certs | |
CAFILE=${CERTS_DIR}/ca-certificates.crt | |
for cert in $(/bin/ls -1 ${BOOT2DOCKER_CERTS_DIR}); do | |
SRC_CERT_FILE=${BOOT2DOCKER_CERTS_DIR}/${cert} | |
CERT_FILE=${CERTS_DIR}/${cert} | |
HASH_FILE=${CERTS_DIR}/$(/usr/local/bin/openssl x509 -noout -hash -in ${SRC_CERT_FILE} 2>/dev/null) |
This file contains 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 | |
# directory to save backups in, must be rwx by postgres user | |
BASE_DIR="/var/backups/postgres" | |
YMD=$(date "+%Y-%m-%d") | |
DIR="$BASE_DIR/$YMD" | |
mkdir -p $DIR | |
cd $DIR | |
# make database backup |
This file contains 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
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb |
This file contains 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
/* | |
pluralForm(28, forms: ["год", "года", "лет"]) | |
output: "лет" | |
*/ | |
func pluralForm(number: Int, forms: [String]) -> String { | |
return number % 10 == 1 && number % 100 != 11 ? forms[0] : | |
(number % 10 >= 2 && number % 10 <= 4 && (number % 100 < 10 || number % 100 >= 20) ? forms[1] : forms[2]) | |
} |
This file contains 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
using System; | |
using System.Collections.Generic; | |
public delegate void Callback(); | |
public delegate void Callback<T>(T arg1); | |
public delegate void Callback<T, U>(T arg1, U arg2); | |
public delegate void Callback<T, U, V>(T arg1, U arg2, V arg3); | |
public enum MessengerMode { | |
DONT_REQUIRE_LISTENER, |
This file contains 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
/* | |
* Copyright (C) 2013 Siddhesh S Shetye | |
* | |
* 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 |
This file contains 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
// Developer/Library/Frameworks/SenTestingKit.framework/Headers/SenTestCaseRun.h | |
SENTEST_EXPORT NSString * const SenTestCaseDidStartNotification; | |
SENTEST_EXPORT NSString * const SenTestCaseDidStopNotification; | |
SENTEST_EXPORT NSString * const SenTestCaseDidFailNotification; | |
// Developer/Library/Frameworks/SenTestingKit.framework/Headers/SenTestDistributedNotifier.h | |
SENTEST_EXPORT NSString * const SenTestNotificationIdentifierKey; | |
// Developer/Library/Frameworks/SenTestingKit.framework/Headers/SenTestSuiteRun.h | |
SENTEST_EXPORT NSString * const SenTestSuiteDidStartNotification; |
This file contains 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
[[UINavigationBar appearance] setTintColor:[UIColor grayColor]]; | |
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault]; // Takes out title | |
UIImage *backButtonImage = [UIImage imageNamed:@"BackArrowDark.png"]; | |
if ([UINavigationBar instancesRespondToSelector:@selector(setBackIndicatorImage:)]) { | |
[[UINavigationBar appearance] setBackIndicatorImage:backButtonImage]; | |
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:backButtonImage]; | |
} else { | |
int imageSize = 21; // REPLACE WITH YOUR IMAGE WIDTH |
NewerOlder