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
const crypto = require('crypto'); | |
// Encrypting... | |
// WARNING: createCipher() is deprecated | |
const cipher = crypto.createCipher('aes-256-cbc', '0000'); | |
let alphabetUpperCase = `ABCDEFGHIJKLMNOPQRSTUVWXYZ`; | |
let cipherText = cipher.update(alphabetUpperCase, 'utf8', 'base64'); | |
console.log(`cipher.update('${alphabetUpperCase}') returns `, `'${cipherText}'`); |
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.util.List; | |
import java.util.ArrayList; | |
public class SortingString { | |
public static void main(String args[]) { | |
String s = "typewriter"; | |
final long start = System.currentTimeMillis(); | |
for (int i = 0; i < Integer.MAX_VALUE; i++) { |
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.example.gee; | |
import android.os.Bundle; | |
import android.app.Activity; | |
import android.view.Menu; | |
import android.widget.TextView; | |
public class MainActivity extends Activity { | |
@Override |
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.example.gee; | |
public class Config { | |
public final static String Company = "@COMPANY@"; | |
} |
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.example.gee; | |
public class Config { | |
public final static String Company = "Google"; | |
} |
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"?> | |
<project name="Gee" default="help"> | |
<target name="deploy" depends="clean"> | |
<property file="build.properties" /> | |
<property name="config-target-path" value="${source.dir}/com/example/gee"/> | |
<input message="Please input company name" addproperty="company" /> | |
<!-- Copy the configuration file, replacing tokens in the file. --> | |
<copy file="config/Config.java" todir="${config-target-path}" |
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
Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.settings"); | |
if (intent != null) | |
startActivity(intent); | |
else | |
Toast.makeText(MainActivity.this, | |
"Could not launch this package.", | |
Toast.LENGTH_LONG).show(); | |
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
final ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE); | |
List<ActivityManager.RunningTaskInfo> infos = am.getRunningTasks(100); | |
for (ActivityManager.RunningTaskInfo info : infos) { | |
Log.d(TAG, info.baseActivity.getPackageName()); | |
} | |
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
final PackageManager pm = getPackageManager(); | |
List<ApplicationInfo> applications = pm.getInstalledApplications(PackageManager.GET_META_DATA); | |
for (ApplicationInfo appInfo : applications) { | |
PackageInfo pkgInfo; | |
try { | |
pkgInfo = pm.getPackageInfo(appInfo.packageName, | |
PackageManager.GET_META_DATA | | |
PackageManager.GET_PERMISSIONS); |
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.slidingmenu.lib; | |
import java.lang.reflect.Method; | |
import android.annotation.SuppressLint; | |
import android.annotation.TargetApi; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Bitmap; |
NewerOlder