Skip to content

Instantly share code, notes, and snippets.

View thelinuxlich's full-sized avatar
🐉
Here be dragons

Alisson Cavalcante Agiani thelinuxlich

🐉
Here be dragons
View GitHub Profile
@thelinuxlich
thelinuxlich / aidax-example-identifyUser.js
Last active July 18, 2017 20:19 — forked from astfarias/aidax-syntax-User.js
AIDAX - Example - Identify User
// Identify User
ax.user({
id: "USER ID", //If the id is an email AIDAX will contextalize the id
properties: {
property1: "value",
property2: "value"
},
migrate: true //optional parameter to migrate old user data in this session to the new user. Default is true
});
@thelinuxlich
thelinuxlich / bench.js
Last active August 29, 2015 14:22 — forked from yyx990803/bench.js
// vue internals
var _ = require('../util')
var Path = require('../parsers/path')
// original implementation using native sort
var original = function (arr, sortKey, reverse) {
if (!sortKey) {
return arr
}
var order = 1
var cluster = require('cluster');
if(cluster.isMaster) {
cluster.fork()
.on('online', function() {
this.disconnect();
});
} else {
process.on('internalMessage', function(msg) {
console.log('internalMsg', msg);
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
var r = require('rethinkdbdash')();
setInterval(function() {
r.table("logs").insert({
date: r.now()
}).run({noreply: true})
, 1000)
r.table("logs").changes().run().then(function(feed) {
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
#get root access
$su -
$ cd /tmp
#Remove old Ruby
$ yum remove ruby
# Install dependencies
$ yum groupinstall "Development Tools"
$ yum install zlib zlib-devel
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }