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
# An Android.mk file must begin with the definition of the LOCAL_PATH variable | |
LOCAL_PATH := $(call my-dir) | |
# The CLEAR_VARS variable is provided by the build system and points to a special | |
# GNU Makefile that will clear many LOCAL_XXX variables for you (e.g. LOCAL_MODULE), | |
# with the exception of LOCAL_PATH. | |
include $(CLEAR_VARS) | |
# The LOCAL_MODULE variable must be defined to identify each module you describe | |
# in your Android.mk. The name must be unique and not contain any spaces. |
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
APP_PROJECT_PATH := <path to project> |
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
// If you are using Java 7, Files (in the standard library) is the best approach: | |
/* You can get Path from file also: file.toPath() */ | |
Files.copy(InputStream in, Path target) | |
Files.copy(Path source, OutputStream out) |
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
str="asdkljfgaskdlgjkladsjfg123_abc_d4e5#asdfgerhgreg" | |
regex="[0-9]+_([a-z]+)_[0-9a-z]*" | |
if [[ $str =~ $regex ]] | |
then | |
name="${BASH_REMATCH[1]}" | |
echo "${name}.jpg" # 123_abc_d4e5.jpg | |
name="${name}.jpg" # same thing stored in a variable | |
else | |
echo "$str doesn't match" >&2 |
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
var json = '{"result":true,"count":1}'; | |
var obj = JSON.parse(json); | |
console.log(JSON.stringify(obj)); |
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
var fs = require("fs"); | |
// Sync | |
var array = fs.readFileSync(path).toString().split('\n'); | |
// Async | |
fs.readFile(path, function(err, f){ | |
var array = f.toString().split('\n'); | |
// use the array | |
}); |
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 HelloWorldApp { | |
public static void main(String[] args) { | |
System.out.println("Hello World!"); // Display the string. | |
} | |
} |
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
public class ArrBlockingQueue { | |
final private Lock _lock = new ReentrantLock(); | |
final private Condition _notFull = _lock.newCondition(); | |
final private Condition _notEmpty = _lock.newCondition(); | |
final private Object[] _items; | |
private int _putptr, _takeptr, _count; | |
public ArrBlockingQueue(final int 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
$(info VAR="$(VAR)") |
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
# Xcode should be the default application for .xcodeproj files, so this should work: | |
open a.xcodeproj | |
# If that opens a different application, you can force it to use xcode: | |
open -a Xcode a.xcodeproj |