{
"Version": "2012-10-17",
"Statement": [{
"Action": [
"sns:CreatePlatformEndpoint"
],
"Effect": "Allow",
"Resource": "arn:aws:sns:****"
}, {
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
angular.module('myApp').factory('audioContext', function() { | |
return new AudioContext(); | |
}); |
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 class MyFaceDetectionListener implements Camera.FaceDetectionListener { | |
private Matrix m = new Matrix(); | |
private RectF rect = new RectF(); | |
// Call this before startFaceDetection(). | |
// targetWidth and targetHeight are usually size of view which shows camera preview. | |
public void setup(boolean useFrontCamera, int displayOrientation, float targetWidth, float targetHeight) { | |
m.setScale(useFrontCamera ? -1 : 1, 1); | |
m.postRotate(displayOrientation); | |
m.postTranslate(1000, 1000); |
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
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/myapp'); | |
var schema = new mongoose.Schema({ | |
name: String | |
}); | |
var model = mongoose.model('MyModel', schema); | |
new model({ |
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
var a = [1, 2, 3, 4, 5]; | |
// shift は先頭を取り出す | |
a.shift(); // -> 1 | |
console.log(a); // -> [2, 3, 4, 5] | |
// push は末尾に入れる | |
a.push(111); | |
console.log(a); // -> [2, 3, 4, 5, 111] |
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
var request = require('request'), | |
Promise = require('promise'), | |
extend = require('extend'); | |
module.exports = QueuedRequest; | |
function QueuedRequest(interval) { | |
this.interval = interval; | |
this.queue = []; | |
this.loop = loop.bind(this); |
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 android.graphics.Matrix; | |
public class MatrixUtils { | |
public static Info decomposition(Matrix matrix, boolean reverseOrder) { | |
double dx, dy, sx, sy, theta; | |
float[] values = new float[9]; | |
matrix.getValues(values); |
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 android.app.Activity; | |
import android.graphics.SurfaceTexture; | |
import android.os.Bundle; | |
import android.renderscript.Allocation; | |
import android.renderscript.Element; | |
import android.renderscript.RenderScript; | |
import android.renderscript.Type; | |
import android.view.Surface; | |
import android.view.TextureView; | |
import android.view.View; |
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 android.content.Context; | |
import android.view.MotionEvent; | |
public class RotateGestureDetector { | |
public static interface OnRotateListener { | |
boolean onRotate(float degrees, float focusX, float focusY); | |
} | |
public static class SimpleOnRotateGestureDetector implements OnRotateListener { | |
@Override |