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
JsonObject json = Json.createObjectBuilder() | |
.add("keyString", "string") | |
.add("keyBoolean", true) | |
.add("keyArraySimple", Json.createArrayBuilder() | |
.add(1) | |
.add(11) | |
.add(111).build()) | |
.add("keyArrayObject", Json.createArrayBuilder() | |
.add(Json.createObjectBuilder() | |
.add("lang", "ja") |
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 com.company.project.util; | |
import java.io.StringReader; | |
import java.io.StringWriter; | |
import javax.json.Json; | |
import javax.json.JsonObject; | |
import javax.json.JsonReader; | |
import javax.json.JsonWriter; |
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 com.company.project.filter; | |
import java.io.IOException; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import javax.servlet.Filter; | |
import javax.servlet.FilterChain; | |
import javax.servlet.FilterConfig; | |
import javax.servlet.ServletException; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- THIS PRODUCT CONTAINS RESTRICTED MATERIALS OF IBM 5724-H88, 5724-J08, | |
5724-I63, 5655-W65, COPYRIGHT International Business Machines Corp., 2014 | |
All Rights Reserved * Licensed Materials - Property of IBM US Government | |
Users Restricted Rights - Use, duplication or disclosure restricted by GSA | |
ADP Schedule Contract with IBM Corp. --> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<licenses> |
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
cd "${PROJECT_DIR}/MyProject/lib/" | |
libs=( IBMMobileFirstPlatformFoundation sqlcipher ) | |
archs=( armv7 armv7s i386 x86_64 arm64 ) | |
# create bunch of thin files. | |
function lipo_extract() { | |
lib=${1} | |
pushd "${lib}.framework" > /dev/null | |
for arch in "${archs[@]}"; do |
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
[8/27/15 15:53:39:235 JST] 0000008b ication.internal.jaas.modules.UsernameAndPasswordLoginModule A CWWKS1100A: Authentication did not succeed for user ID oLs3jn4fNG. An invalid user ID or password was specified. | |
[8/27/15 15:53:39:350 JST] 000000b0 SystemErr R java.util.zip.ZipException: zip file is empty | |
[8/27/15 15:53:39:350 JST] 000000b0 SystemErr R at java.util.zip.ZipFile.open(Native Method) | |
[8/27/15 15:53:39:351 JST] 000000b0 SystemErr R at java.util.zip.ZipFile.<init>(ZipFile.java:220) | |
[8/27/15 15:53:39:351 JST] 000000b0 SystemErr R at java.util.zip.ZipFile.<init>(ZipFile.java:150) | |
[8/27/15 15:53:39:351 JST] 000000b0 SystemErr R at java.util.jar.JarFile.<init>(JarFile.java:166) | |
[8/27/15 15:53:39:351 JST] 000000b0 SystemErr |
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
// There is a bug in WebKit | |
// Local files cannot be read unless they are in the tmp/www/ directory! | |
// Example: read "file.pdf" into WKWebView | |
var fileManager = NSFileManager.defaultManager() | |
var srcPath = NSBundle.mainBundle().pathForResource("file", ofType: "pdf") | |
var tmpPath = NSTemporaryDirectory().stringByAppendingPathComponent("www") | |
// TODO: handler errors correctly | |
fileManager.createDirectoryAtPath(tmpPath, withIntermediateDirectories: true, attributes: nil, error: nil) | |
var dstPath = tmpPath.stringByAppendingPathComponent("file.pdf") |
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
$ swiftc -emit-ir /Users/nacho4d/Desktop/function2/function2/main.swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk | |
; ModuleID = '-' | |
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-apple-darwin14.0.0" | |
%0 = type opaque | |
%1 = type opaque | |
%Si = type <{ i64 }> | |
%CSo8NSObject = type opaque | |
%swift.type = type { i64 } |
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
// https://oj.leetcode.com/problems/majority-element/ | |
// Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. | |
// You may assume that the array is non-empty and the majority element always exist in the array. | |
class Solution { | |
public: | |
// Hash table | |
int majorityElement_hashtable(vector<int> &num) { | |
std::map <int, int> table; | |
for (int n : num) { |
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 -x | |
# This is a CodeRunner compilation script. Compilation scripts are used to | |
# compile code before being run using the run command specified in CodeRunner | |
# preferences. This script should have the following properties: | |
# | |
# Launch directory ($PWD): Will be the same as the file being run | |
# | |
# Exit status: Should be 0 on success (will cause CodeRunner | |
# to continue and execute the run command) | |
# |