Skip to content

Instantly share code, notes, and snippets.

@andikan
andikan / Info.plist
Created March 6, 2019 11:00
react native play video/audio sample
...
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
...
ArrayList<GData> getNorthGaussBits() {
ArrayList<GData> northGaussBits = new ArrayList<GData>();
if (wsData != null) {
JSONArray gaussBits = JSONObject.parse(wsData).getJSONArray("northGaussBits");
for(int i=0; i<gaussBits.size(); i++) {
JSONObject gb = gaussBits.getJSONObject(i);
northGaussBits.add(new GData(gb.getFloat("x")*width, gb.getFloat("y")*height, gb.getFloat("intensity"), gb.getFloat("angle"), gb.getFloat("pitch")));
}
}
return northGaussBits;
function line(x1, y1, x2, y2) {
game.debug.context.beginPath();
game.debug.context.moveTo(x1, y1);
game.debug.context.lineTo(x2, y2);
game.debug.context.stroke();
}
function getTrajectoryPoint(startX, startY, velocityX, velocityY, n) {
int pressTime = 60000;
int buttonPin = 2;
int buzzerPin = 3;
int melody[] = {523, 587, 659, 698, 784, 880, 988, 1047};
int duration = 500;
int previousButtonState = 0;
int buttonState = 0;
@andikan
andikan / Ball.pde
Last active September 6, 2015 06:21
Ball.pde
class Ball {
float x;
float y;
int size;
PVector v;
color c;
Ball(float x, float y, int size) {
this.x = x;
this.y = y;
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new
class ApiLogger < Grape::Middleware::Base
def before
Rails.logger.info "[api] Requested: #{request_log_data.to_json}\n" +
"[api] #{response_log_data[:description]} #{response_log_data[:source_file]}:#{response_log_data[:source_line]}"
end
private
def request_log_data
package main
import (
eventsource "github.com/antage/eventsource/http"
redis "github.com/vmihailenco/redis"
"log"
"net/http"
)
func haltOnErr(err error){
/*
Chrome Packaged app Bluetooth API test
Before interacting with a BT device, you need to :
1) get the device MAC and service UUID with startDiscovery and getServices methods
2) request permission with chrome.permissions.request
3) add the service profile with chrome.bluetooth.addProfile (a profile is only {uuid:'xxxxxxx...'})
*/
// onConnection callback
chrome.bluetooth.onConnection.addListener(
// in setupMesh function
if(!meshTemp.checkLargeTriangle((*triangles)[i])) {
spineEdgeSet = meshTemp.getSkeletonPointSet(*meshTemp.ps);
spineEdgeSet = meshTemp.getSimplifiedPointEdgeSet(spineEdgeSet);
}