Skip to content

Instantly share code, notes, and snippets.

View maisnamraju's full-sized avatar

Maisnam Raju Singh maisnamraju

View GitHub Profile
@maisnamraju
maisnamraju / gist:c7d4ad274c1f6159b96dbee0180ee358
Created March 2, 2017 10:52
Check for 44371900569F and 15 days
{"unit":"d","values":[[1487100600000,822013.9236842105,1086926.1736842105,1707292.2578947367,68708414.75],[1487187000000,1299176.7805555556,1654508.4868055556,2365664.8548611114,127664402.93333334],[1487273400000,1465469.411111111,1811391.7770833336,2567056.5868055555,140254026.6],[1487359800000,1143490.0770833332,1427996.865972222,2045996.1194444445,110819593.5],[1487446200000,1556465.7798611112,1883760.5184027776,2782667.3233796298,167502893.51666665],[1487532600000,1474878.972222222,1827149.161111111,2669417.353472222,143314691.68333334],[1487619000000,791752.6909722221,914076.6395833333,1387845.9701388888,74248207.21666665],[1487705400000,1191156.1541666666,1649674.4493055556,2250951.9291666667,122202780.78333333],[1487791800000,1893747.81517094,2338579.518910256,3271600.866559829,163601690.30000004],[1487878200000,1150275.370138889,1430092.6847222224,2121428.8520833333,112843125.76666665],[1487964600000,1380634.4347222222,1730927.4999999998,2443052.826388889,133310754.26666667],[1488051000000,1610405.220
@maisnamraju
maisnamraju / json
Created March 18, 2017 09:16
Dummy data for mapreduce
[
{
"_id": "58ccfa5a0be030fced6ca39a",
"hour": "2017-03-03T06:00:00 -06:-30",
"minutesSecondsData": {
"1": {
"1": 21,
"2": 47,
"3": 36,
"4": 34,
db.users.aggregate([
{ "$unwind": { "path": "$access" } },
{
"$project": { "roleId": "$access.id", "role": "$access.role", "email": "$email" }
},
{
"$lookup": {
"from" :"accoounts",
db.users.aggregate(
// Pipeline
[
// Stage 1
{
$unwind: { "path": "$access" }
},
@maisnamraju
maisnamraju / gist:768dc5bcbfd58f4c740bcd2b8c64942e
Created April 4, 2017 04:59
Gets the data correct but the ids and emails among other things come out as arrays
db.users.aggregate(
// Pipeline
[
// Stage 1
{
$unwind: { "path": "$access" }
},
// Stage 2
@maisnamraju
maisnamraju / app.module.ts
Created July 14, 2017 06:17
Reactive forms in angular
import { ReactiveFormsModule } from '@angular/forms';
@NgModule({
imports: [
...,
ReactiveFormsModule
],
declarations: [...],
bootstrap: [...]
})
@maisnamraju
maisnamraju / ajax.js
Last active September 10, 2017 18:35
vue-resource retry on fail
getUserGlobalConfig(userId) {
let retries = 3;
return new Promise((resolve, reject) => {
let request = Vue.http.get(`/api/user/${userId}`)
.then((response) => resolve(response.data.data))
.catch((error) => {
if(retries > 0) {
setTimeout( () => {
request();
}, 800);
@maisnamraju
maisnamraju / how-to-set-up-stress-free-ssl-on-os-x.md
Created February 27, 2018 01:17 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@maisnamraju
maisnamraju / gist:8b2a33249513caf1daca5a1e43c479d0
Created March 26, 2018 14:02
SushiNearMe Stack and Modules
Backend Stack - Firestore, Firebase Cloud Functions, GeoFire , Google Maps API, Stripe, Electron
FrontEnd - VueJS, NuxtJS for server side rendering, Google Maps API
3 modules
---------
Guest Facing Side
-----------------
- View List
- View Restaurant
{
"_id" : ObjectId("5af99f1f5b51a81520f620fa"),
"City" : "Jakarta",
"Name" : "Kisaku Japanese Restaurant",
"Street" : "",
"Street_Number" : "",
"Postal" : NumberInt(13960),
"Locality" : "",
"Country" : "Indonesia",
"Formatted_Address" : "Ujung Menteng; Cakung; East Jakarta City; Jakarta 13960; Indonesia",