This file contains hidden or 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
// Initialize the Facebook SDK with Parse as described at | |
// https://parse.com/docs/js_guide#fbusers | |
window.fbAsyncInit = function() { | |
// init the FB JS SDK | |
Parse.FacebookUtils.init({ | |
appId : '289802934544559', // Facebook App ID | |
cookie : true, // enable cookies to allow the server to access | |
// the session | |
xfbml : true, // parse social plugins on this page | |
version : 'v1.0' // use version 1 |
This file contains hidden or 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
#!/usr/bin/env coffee | |
fs = require 'fs' | |
# Get the file name that’s passed as the first argument | |
nameOfFile = process.argv.slice(2)[0] | |
# Read the file and convert it from bytes to a string | |
file = fs.readFileSync(nameOfFile).toString() |
This file contains hidden or 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
PARSE_APPLICATION_ID = 123456789; | |
PARSE_REST_API_KEY = 123456789; | |
var messageText = "canned alert"; | |
var parseMessage = { | |
"channels": "", | |
"type": "ios", | |
"expiration_interval": 86400, | |
"data": { | |
"alert": messageText, |
This file contains hidden or 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
# converts Parse.com json object presentation to CSV with simple filtering | |
# dependency - jq command line tool | |
# NOTE: Parse.com API does not allow to get more than 1000 records per request, so you need to vary skip and limit params | |
# https://www.parse.com/docs/rest#general-quick | |
# NOTE: Also you can download exported Parse.com backup (Parse.com\Settings\Export) and read via "cat filename | jq '.'". | |
echo `curl -H 'X-Parse-Application-Id: <PASTE_YOUR_APP_ID_HERE>' -H 'X-Parse-REST-API-Key: <PASTE_YOUR_REST_API_KEY_HERE>' -H 'Content-Type: application/json' -L https://api.parse.com/1/classes/Email\?skip=0\&limit=1000 -s` | jq '.results[] | .email +","+.type +","+ .createdAt' |
This file contains hidden or 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
// Enable or reset Disqus for this page as required, with optional SSO. | |
// There must be a div with id "disqus_thread" when called. | |
// | |
// config is required and should have the format: | |
// | |
// { | |
// shortname: "..", | |
// title: "..", | |
// identifier: "..", | |
// url: ".." |
This file contains hidden or 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
var regexp = /(([\$\£\€\u20AC]|eur|ils|rs)\.?\s*(<[^>]+>| |\s)?([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)|(([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)(<[^>]+>| |\s|\s\,\-\s)?(€|\u20AC|eur|ils|rs)\.?/ig; | |
document.body.innerHTML.match(regexp); |
This file contains hidden or 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
// Require the SendGrid Cloud Module | |
var sendgrid = require("sendgrid"); | |
sendgrid.initialize("you@parse.com", "your_password"); | |
// Run this Cloud Function every time a new Activity (such as a comment) | |
// is saved | |
Parse.Cloud.afterSave("Activity", function(request, response) { | |
// Check if the activity type is a comment | |
var activity = request.object; | |
if (activity.get("type") === "comment") { |
This file contains hidden or 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
// node: | |
var moment = require('moment'); | |
moment().add('days', 2).fromNow(); | |
// 'in 2 days' | |
moment().subtract('days', 2).fromNow(); | |
// '2 days ago' | |
moment('November 1977').fromNow() |