View useCrisp.js
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 { useEffect, useRef } from 'react'; | |
import { useScript } from './useScript'; | |
//This will generate a new number every hour | |
//Crisp has a terrible CDN handeling process, this forces to load last version every hour | |
const getDateSeconds = () => { | |
const date = new Date(); | |
const time = date.getTime(); | |
return Math.floor(time / 3600000); |
View GTM_FORCE_reload.js
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
<script> | |
/* | |
This script will force reload of the page based on the harcoded version. | |
Create as tag and Use GTM to trigger execution. | |
*/ | |
var GTMRELOADER_CURRENT_VERION = '1'; | |
var GTMRELOADER_KEY_NAME = 'VERSION'; | |
function canIUseLocalStorage(){ | |
var test = 'test_ls_test'; |
View Redis FIFO writer to Postgres
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 redis from "redis"; | |
client = redis.createClient(); | |
exitProcessor = false; | |
queueNext = () => { | |
process.nextTick(() => { | |
// Messages are pushed with RPUSH, making this a FIFO queue | |
client.blpop('queue', 1, queueFn); | |
View react-d3.jsx
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 React from 'react'; | |
import { autobind } from 'core-decorators'; | |
import d3 from 'd3'; | |
import moment from 'moment'; | |
import classNames from 'classnames'; | |
import { getFirstDate } from 'utils/Consolidator'; | |
import { shouldComponentUpdate } from 'utils/shouldUpdate'; | |
import { classes, sort } from 'utils/Presentation'; | |
import Money from 'utils/Money'; |
View index.js
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
'use strict'; | |
import React, {Component} from "react"; | |
import {StyleSheet, Text, View} from "react-native"; | |
import Icon from 'react-native-vector-icons/FontAwesome'; | |
import { Actions } from 'react-native-router-flux'; | |
export default class ToolBar extends Component { | |
static contextTypes = { | |
drawer: React.PropTypes.object |
View index.js
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 React, { | |
Component, | |
PropTypes, | |
} from 'react'; | |
import { | |
StatusBar, | |
Text, | |
View, | |
StyleSheet, | |
PixelRatio, |
View gist:858c1afaee170a3a141adc7da652883e
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
//This is a Redacted version to be used as a benchmark/example for React Native Router Flux | |
import React, { | |
Component, | |
StatusBar, | |
Text, | |
View, | |
StyleSheet, | |
PixelRatio, | |
} from 'react-native'; |
View gist:01a2d43da94bb5290d7a8c7b332a2a79
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
/** | |
* Sends a Message to AWS topic | |
*/ | |
import AWS from 'aws-sdk'; | |
const message = { | |
test: "Test Message", | |
error: "Error test", | |
}; |
View imageSyncing.js
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
// dependencies | |
var async = require('async'); | |
var path = require('path'); | |
var AWS = require('aws-sdk'); | |
var gm = require('gm').subClass({ | |
imageMagick: true | |
}); | |
var util = require('util'); | |
// get reference to S3 client | |
var s3 = new AWS.S3(); |
View gist:f5ff8a16124365b8a113
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
Schema.virtual('comments') | |
//Returns comment owned by this product | |
.get( | |
async obj => await Comment | |
.find({ 'owner': this._id, deleted: { $ne: true } }) | |
.sort('-likesCount -date_modified') | |
.limit(6) | |
.exec() | |
); |
NewerOlder