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
@implementation AutoRotatingWindow | |
- (instancetype)initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; | |
if (self) | |
{ | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willRotate:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; | |
} | |
return self; |
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
<html> | |
<head> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
navigator.os = (function() { | |
var ua = navigator.userAgent, tem, | |
M= ua.match(/.*\((.+?);.*?([012356789_\.]+).*?\).*/i) || []; | |
return M[1]; |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
func sort(data []int, pleft, pleft_end, pright, pright_end int) { |
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 java.io._ | |
import java.security._ | |
import org.apache.commons.codec.binary.Base64 | |
object SecureCredentials { | |
def isValidPassword(password: String, hashedPassword: String, passKey: String) = { | |
try { | |
val theHashedPassword = hash(password, passKey) |
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 java.sql.{Timestamp, Date} | |
import org.codehaus.jackson.map._ | |
import org.codehaus.jackson.{Version, JsonGenerator, JsonParser} | |
import java.util.TimeZone | |
import java.text.SimpleDateFormat | |
import com.codahale.jerkson.Json | |
import org.codehaus.jackson.map.module.SimpleModule | |
import org.codehaus.jackson.map.annotate.JsonSerialize | |
object CustomJson extends Json { |
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 com.codahale.jerkson.Json | |
import org.codehaus.jackson.map.module.SimpleModule | |
import org.codehaus.jackson.{JsonParser, JsonGenerator, Version} | |
import org.codehaus.jackson.map.annotate.JsonCachable | |
import org.codehaus.jackson.map.{DeserializationContext, JsonDeserializer, SerializerProvider, JsonSerializer} | |
object CustomJson extends Json { | |
val module = new SimpleModule("CustomJson", Version.unknownVersion()) | |
// --- (SERIALIZERS) --- | |
module.addSerializer(classOf[Enumeration#Value], new JerksonEnumerationSerializer()) |
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
package utils | |
import com.twitter.querulous.query.SqlQueryFactory | |
import com.twitter.querulous.evaluator.StandardQueryEvaluatorFactory | |
import com.twitter.querulous.database.ApachePoolingDatabaseFactory | |
import com.twitter.util.Duration | |
import java.util.concurrent.TimeUnit | |
import play.api.Play.current | |
import play.api.Play.configuration |
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 net.liftweb.json.JsonAST.{JObject, JField, JString, JValue} | |
import net.liftweb.json._ | |
import net.liftweb.json.JsonAST.JField | |
import net.liftweb.json.JsonAST.JObject | |
import net.liftweb.json.JsonAST.JString | |
import net.liftweb.json.TypeInfo | |
import net.liftweb.json.MappingException | |
class EnumerationSerializer[T <: Enumeration#Value](enum: Enumeration, clazz: Class[T]) extends Serializer[T] { |
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
#pragma mark - Handle Keyboard Appearance/Disappearance | |
- (void)keyboardWasShown:(NSNotification*)aNotification | |
{ | |
NSDictionary* info = [aNotification userInfo]; | |
CGRect kbRect = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; | |
kbRect = [self.view convertRect:kbRect toView:nil]; | |
CGRect viewRect = [self.view convertRect:self.view.frame fromView:nil]; | |
CGRect newRect = CGRectMake(viewRect.origin.x | |
,viewRect.origin.y |
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
// keyStore (client cert) | |
System.setProperty("javax.net.ssl.keyStoreType" , "pkcs12"); // corresponds to `.keyStore` | |
System.setProperty("javax.net.ssl.keyStore" , "clientcert.p12"); | |
System.setProperty("javax.net.ssl.keyStorePassword" , "password"); // | |
// trustStore (server cert) | |
System.setProperty("javax.net.ssl.trustStoreType" , "jks"); // corresponds to `.trustStore` | |
System.setProperty("javax.net.ssl.trustStore" , "servercert.keystore"); // path to server truststore, when the server cert is imported into | |
System.setProperty("javax.net.ssl.trustStorePassword", "password"); | |
// The above code can be substituted with below parameters when starting the jvm |
NewerOlder