Skip to content

Instantly share code, notes, and snippets.

View ralphievolt's full-sized avatar

ralph emerson ralphievolt

View GitHub Profile
@ralphievolt
ralphievolt / ExtractSpecificTextFromEmail.txt
Created May 10, 2020 08:31 — forked from moayadhani/ExtractSpecificTextFromEmail.txt
Extract Email Text from Google Sheet using App Script
//Sample email that is received and whose details are extracted:
/*
*Someone* just submitted your form named Online Course Booking from your
website
https://www.abcd.com/
Message Details
Full Name: Mohamed Ali
Email Address: [email protected]
Phone Number: 009725991122334
@ralphievolt
ralphievolt / mostPostedTracks.js
Created November 5, 2018 04:35 — forked from adrienjoly/mostPostedTracks.js
mongodb "group by" query using aggregation for counting documents per category, on a objectid-timestamp-based subset
db = db.getSiblingDB("whyd_music") // explicitely select collection
var jan2014 = ObjectId("52c35a800000000000000000"); // created using http://steveridout.github.io/mongo-object-time/
db.post.aggregate([
{"$sort": {"_id": -1}}, // order: antichronological
{"$match": {"_id": {"$gt": jan2014}}}, // only documents that were created after the 1syt january 2014
{"$group": {"_id": "$eId", // group by value of the eId attribute -> _id attribute in the resulting output collection
"name": {"$first": "$name"}, // -> include the name of each grouped category
"count": {"$sum": 1}}}, // -> count attribute will contain the number of documents for each value of _eid
{"$match": {"count": {"$gt": 50}}}, // limit output to results with count > 50
{"$sort": {"count": -1}} // output order: highest count first
//package
node-cron
// import
import cron from 'node-cron';
// calling
const loginChecker = cron.schedule('0 0 */2 * * *', function () {
if (Meteor.userId() === null)
history.push("/login");
@ralphievolt
ralphievolt / Account.config
Last active September 9, 2017 16:00
Meteor Auto Login API
import { Accounts } from 'meteor/accounts-base'
Accounts.config({
loginExpirationInDays: 0.02
})
@ralphievolt
ralphievolt / mysql-docker.sh
Created April 27, 2017 00:39 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@ralphievolt
ralphievolt / Clear Client Collection
Created March 24, 2017 19:11
Clearing a Meteor Client Only Collection
Reports._collection.remove({})
@ralphievolt
ralphievolt / meteor+ nginx
Created December 7, 2016 00:04
METEOR APP DEPLOYMENT + NGINX
# METEOR APP DEPLOYMENT
# ensure proper version of Meteor running inside your app
1. meteor update
# or for specific release
meteor update --release 1.3.1
# remove any existing bundle folder
2. rm -rf ~/bundle
@ralphievolt
ralphievolt / nginx install
Created December 7, 2016 00:03
NGINX Installatation
## REFERENCE : https://medium.com/@tomgoldenberg/deploying-a-meteor-app-with-nginx-from-scratch-1332b32e99a5#.tme24q15r
## Install Forevever
> npm install -g forever
> forever list
# terminal will show below
# info: No forever process running
# cd to you app directory and run
# check package.json and ensure no space in between in { "name": "APP_NAME" ..... } to prevent error
@ralphievolt
ralphievolt / gist:8d10a64de583ff2ed32adcd5bdcf69dc
Created December 7, 2016 00:03
Node and Mongodb Installation
# Install NODE via NVM
https://github.com/creationix/nvm
# ############################################################################################################
MONGODB INSTALLATION
# ref https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-ubuntu/
# ############################################################################################################
> sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10