Skip to content

Instantly share code, notes, and snippets.

View imana97's full-sized avatar

Iman Far imana97

View GitHub Profile
@imana97
imana97 / js-queue.js
Last active August 29, 2015 14:00
queueing function execution in javascript
var Queue = function() {
// copy this to self
var self = this;
//initiating an empty queue
self.queue = [];
//initiating an empty object for to keep the last json data fetched by ajax
self.lastData = null;
// this methods add a function to the queue
self.next = function(func) {
@imana97
imana97 / Gstrap.js
Created October 25, 2016 20:57
Gstrap Framework
(function(window,$,ejs){
window.Gstrap={}; // define g
Gstrap.framework = {
version: 0.31,
description: "Mini modular single page Javascript framework built on top of jQuery and EJS.co",
developer: "Iman Khaghani Far",
contact: "iman.khaghani@gmail.com",
license: "MIT",
repository: "https://github.com/imana97/gstrap"
};
@imana97
imana97 / bulker.js
Created November 2, 2016 00:39
Bulk Process of large arrays in Javascript
module.exports=function(array,bulkSize,job){
if (!array) throw new Error('Array is not specified');
if (!job) throw new Error('Must define the job');
var i = 0;
var j = array.length;
var chunkArr = []; // this keeps the chunk values
var chunk=bulkSize || 500000; // default value is half a million
@imana97
imana97 / parseLive.js
Created March 7, 2017 20:39
parse live service
angular.module('coachApp').service("parseAngular", ['$q', '$filter', function ($q,$filter) {
// keep the live query out, so we don't create duplicate!
var liveQuery={};
// parse 3 class
var Live = function (scope, child, query, live) {
/**
* private properties
{"gyroscopeSensor":[{"gx":-1.0087890625,"gdz":-1.432926893234253,"gdx":0.3658536672592163,"gz":0.021728515625,"gy":0.002685546875,"gdy":0.5182926654815674,"timeStamp":1479145194102},{"gx":-1.008056640625,"gdz":-1.4634146690368652,"gdx":0.4268292784690857,"gz":0.022216796875,"gy":0.003662109375,"gdy":0.4573170840740204,"timeStamp":1479145194235},{"gx":-1.008544921875,"gdz":-1.432926893234253,"gdx":0.3658536672592163,"gz":0.021240234375,"gy":0.00244140625,"gdy":0.4573170840740204,"timeStamp":1479145194367},{"gx":-1.0087890625,"gdz":-1.432926893234253,"gdx":0.3048780560493469,"gz":0.021484375,"gy":0.00341796875,"gdy":0.4268292784690857,"timeStamp":1479145194484},{"gx":-1.010498046875,"gdz":-1.4634146690368652,"gdx":0.3658536672592163,"gz":0.0205078125,"gy":0.00341796875,"gdy":0.396341472864151,"timeStamp":1479145194641},{"gx":-1.00732421875,"gdz":-1.4939024448394775,"gdx":0.3048780560493469,"gz":0.021240234375,"gy":0.0009765625,"gdy":0.4268292784690857,"timeStamp":1479145194748},{"gx":-1.009765625,"gdz":-1.49390
{
"gyroscopeSensor": [
{
"gx": -1.0087890625,
"gdz": -1.432926893234253,
"gdx": 0.3658536672592163,
"gz": 0.021728515625,
"gy": 0.002685546875,
"gdy": 0.5182926654815674,
"timeStamp": 1479145194102
{
"gyroscopeSensor": [
{
"gdx": -0.4573170840740204,
"gz": 0.02392578125,
"gy": 0.021728515625,
"gdz": -0.792682945728302,
"gx": -1.01318359375,
"gdy": 0.030487805604934692,
"timeStamp": 1503436579763
@imana97
imana97 / parse-mobx.js
Last active January 22, 2019 03:11
ParseMobx replace Parse Objects and makes them observable
// Import from mobx
import {action, configure, extendObservable, runInAction} from "mobx";
// Configure mobx strictMode. so any changes to observable must be in actions.
configure({enforceActions: "observed"});
/**
* Main Class
*/
@imana97
imana97 / fitbit-xwell-example.js
Created February 1, 2019 20:43
example of how to fetch data from fitbit.
/**
* Contact Info:
* Created by imano on 6/27/17.
*/
var express = require('express');
var router = express.Router();
var FitbitApiClient = require('fitbit-node');
var config = require('../config-server');
'use strict';
/**
* @ngdoc directive
* @name ngXwell.directive:fileManager
* @description
* # fileManager
*/
angular.module('ngXwell')
.directive('fileManager', function () {