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
#!/usr/bin/env node | |
const URL = require('url').URL, | |
crypto = require('crypto'); | |
/** | |
* | |
* @param string url |
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
public static String getLogcat() { | |
BufferedReader br = null; | |
try { | |
Process process = Runtime.getRuntime().exec( new String[] { | |
"logcat", "-d" //, "-v", "time", "-s", "*:W" | |
}); | |
br = new BufferedReader( new InputStreamReader(process.getInputStream()), 8*1024); | |
String line; | |
StringBuilder log = new StringBuilder(); | |
while ( (line = br.readLine()) != 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
// what's the difference (if any) between | |
setInterval(function() { | |
console.log("hello") | |
}, 1000); | |
// and: | |
setTimeout(function() { | |
console.log("hello") |
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
try { | |
BitmapFactory.Options options = new BitmapFactory.Options() {{ | |
inJustDecodeBounds = true; | |
}}; | |
BitmapFactory.decodeStream(getContentResolver().openInputStream(imageUri), null, options); | |
final int wResample = (options.outWidth > profileThumb.getWidth()) ? options.outWidth / profileThumb.getWidth() : 1; | |
final int hResample = (options.outHeight > profileThumb.getHeight()) ? options.outHeight / profileThumb.getHeight() : 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
<?php | |
function vvv() { | |
return [10 => 1111, 20 => 222222, 30, 40]; | |
} | |
// Works OK | |
var_dump( vvv()[10] ); | |
function ccc() { | |
return function() { |
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
/** | |
* What you get in console after this script execution? | |
*/ | |
for (var i=0; i<5; i++ ) { | |
setTimeout(function() { | |
console.log(i) | |
}, i*1000) | |
} |