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
/* | |
* OpenSimplex Noise in Java. | |
* by Kurt Spencer | |
* | |
* v1.1 (October 5, 2014) | |
* - Added 2D and 4D implementations. | |
* - Proper gradient sets for all dimensions, from a | |
* dimensionally-generalizable scheme with an actual | |
* rhyme and reason behind it. | |
* - Removed default permutation array in favor of |
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
$ export JAVA_HOME=/jdk/location/ #finish with / is important here, there is a bug in the installer | |
$ npm install ella |
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
#install perf in Archlinux | |
sudo pacman -Sy perf | |
#install perf in Fedora | |
sudo dnf install perf |
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
function freq(acc, next){ | |
if(acc[next] === undefined) | |
acc[next] = 1; | |
else | |
acc[next] += 1; | |
return acc | |
} | |
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
perf record -F 99 -p `pgrep -n node` | |
# Example: | |
# F is the sampling frequency in hertz. | |
# p is the proccess ID (PID). | |
# Example: pgrep -n node >> 1801 << returning the PID of a process called node. |
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
mkdir hello && cd hello # creating your workspace | |
npm init # this will create a package.js | |
npm install nan@latest --save # this give native headers nan.h, that wraps and adapts different version of v8.h | |
sudo npm install node-gyp -g # this install the building command to compile your native addon. |
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
#include <nan.h> | |
using namespace v8; | |
using namespace Nan; | |
void addWorld(const FunctionCallbackInfo<Value>& info) { | |
info.GetReturnValue().Set(New("world").ToLocalChecked()); | |
} | |
void Init(Local<Object> exports) { |
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
{ | |
"targets": [{ | |
"target_name": "hello", | |
"sources": ["src/hello.cc"], | |
"include_dirs": [ | |
"node_modules/nan" | |
], | |
"cflags": ["-std=c++11", "-Wall", "-pedantic"] | |
}] |
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 * as $fh from 'fh-js-sdk'; | |
import _ from 'underscore'; | |
export class PushNotification { | |
constructor(pushConfiguration) { | |
$fh.push(this.handleNotification.bind(this), | |
this.registration, | |
this.registrationError, | |
pushConfiguration |
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
//Example: file:///android_asset/index.html | |
function printInternalFile(param) { | |
/* generate pdf using url. */ | |
if(cordova.platformId === 'ios') { | |
// To use window.resolveLocalFileSystemURL, we need this plugin https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/ | |
// You can add this by doing cordova plugin add cordova-plugin-file or |
OlderNewer