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
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
public class Test { | |
public static void main(String[] args) throws IOException { | |
InputStreamReader r = new InputStreamReader(System.in); | |
BufferedReader b = new BufferedReader(r); | |
String userInput = b.readLine(); | |
System.out.println("user input :"+userInput); |
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
.wrapped { | |
position: relative; | |
width: 100%; | |
height: 100%; | |
} | |
.centered (@width, @height) { | |
position: absolute; | |
top: 50%; | |
left: 50%; |
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
.top-to-bottom-gradient (@top-color, @bottom-color) { | |
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(@top-color), to(@bottom-color)); /* Safari 4-5, Chrome 1-9 */ | |
background: -webkit-linear-gradient(top, @top-color, @bottom-color); /* Safari 5.1, Chrome 10+ */ | |
background: -moz-linear-gradient(top, @top-color, @bottom-color); /* Firefox 3.6+ */ | |
background: -ms-linear-gradient(top, @top-color, @bottom-color); /* IE 10 */ | |
background: -o-linear-gradient(top, @top-color, @bottom-color); /* Opera 11.10+ */ | |
} |
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
function randomToken(length) { | |
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz0123456789+/' | |
, string = '' | |
, randomNumber | |
, i; | |
length = length ? length : 32; | |
for (i = 0; i < length; i++) { | |
randomNumber = Math.floor(Math.random() * chars.length); |
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
// Copyright (C) 2013 Polychrom Pty Ltd | |
// | |
// This program is licensed under the 3-clause "Modified" BSD license, | |
// see LICENSE file for full definition. | |
package com.polychrom.examples; | |
import java.util.concurrent.ExecutorService; | |
import android.app.Activity; |
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
Show hidden characters
{ | |
// -------------------------------------------------------------------- | |
// JSHint Configuration, Strict Edition | |
// -------------------------------------------------------------------- | |
// | |
// This is a options template for [JSHint][1], using [JSHint example][2] | |
// and [Ory Band's example][3] as basis and setting config values to | |
// be most strict: | |
// | |
// * set all enforcing options to true |
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 cluster = require('cluster'); | |
var http = require('http'); | |
var numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
// Fork workers. | |
for (var i = 0; i < numCPUs; i++) { | |
cluster.fork(); | |
} |
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 static Bitmap blur(Context context, Bitmap sentBitmap, int radius) { | |
if (VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { | |
Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true); | |
final RenderScript rs = RenderScript.create(context); | |
final Allocation input = Allocation.createFromBitmap(rs, sentBitmap, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT); | |
final Allocation output = Allocation.createTyped(rs, input.getType()); | |
final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); | |
script.setRadius(radius); //0.0f ~ 25.0f |
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 static Bitmap getCircularCroppedBitmap(Bitmap bitmap, int radius) { | |
Bitmap scaledBitmap; | |
if (bitmap.getWidth() != radius || bitmap.getHeight() != radius) { | |
scaledBitmap = Bitmap.createScaledBitmap(bitmap, radius, radius, false); | |
} else { | |
scaledBitmap = bitmap; | |
} | |
Bitmap output = Bitmap.createBitmap(scaledBitmap.getWidth(), scaledBitmap.getHeight(), Bitmap.Config.ARGB_8888); |
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 static Bitmap getScaledBitmapFromUri(Context context, Uri uri) { | |
InputStream inputStream; | |
try { | |
inputStream = context.getContentResolver().openInputStream(uri); | |
BitmapFactory.Options options = new BitmapFactory.Options(); | |
options.inJustDecodeBounds = true; | |
BitmapFactory.decodeStream(inputStream, null, options); | |
inputStream.close(); | |
int width = options.outWidth; |
OlderNewer