Skip to content

Instantly share code, notes, and snippets.

@giastfader
giastfader / machine.js
Created November 11, 2019 17:03
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@giastfader
giastfader / column_placeholder_map.js
Created January 28, 2019 11:14
Using GForm to populate a GDoc Template
//this object maps GSheet column into convenient placeholders used into GDocs templates
var columns_placeholder_map = {
"chronological information" : "date_time",
"Please, insert the company name" : "company_name",
"Company director first name" : "first_name",
"Company director last name" : "last name",
"Price (in $)" : "price"
//...
//...
}
@giastfader
giastfader / javascript-example.js
Created December 15, 2015 16:23 — forked from freyr/javascript-example.js
GetResponse APIv2 example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<meta name="Author" content="Pawel Pabian, Pawel Nejczew http://implix.com" />
<title>Demonstrates how to add new contact to campaign.</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
@giastfader
giastfader / venues.fs.search.js
Last active September 3, 2015 12:22 — forked from soukron/venues.fs.search.js
Simple plugin for Baasbox to act as an API gateway for Foursquare venues API
/* script: venues.fs.search */
/* This script endpoint: /plugin/venues.fs.search */
on('install',function(installEvent){
var success = Box.DB.createCollection('venues-cache-queries');
var success = Box.DB.createCollection('venues-cache-answers');
return true;
});
var getParseHeader = function () {
return {
"X-Parse-Application-Id": "ENTER_APP_ID",
"X-Parse-REST-API-Key": "ENTER_API_KEY",
"Content-Type": "application/json"
};
};
var getParseUrl = function (className) {
return "https://api.parse.com/1/classes/" + className;
#!/bin/bash
#post .js file contents to BaasBox to create plugin
#usage bash postBaasBoxPlugin.sh sample.js
#get fileName
fileName="$1"
#uncomment below line to read file contents to variable
#codeContent=$(<$fileName)
@giastfader
giastfader / bb.check_user_exists.js
Created February 23, 2015 23:29
BaasBox: checks if a username exists
/* script: bb.check_user_exists */
/* This script endpoint: /plugin/bb.check_user_exists */
/*usage:
GET /plugin/bb.check_user_exists?username=<username_to_check>
/* returns error 404 if the specified username does not exists, otherwise it returns the public profile */
http().get(function(req){
var user=req.queryString.username[0];
var res=Box.Users.find({
//Project definition
{
"name":"Project name",
"url":"http://projectname.com",
"issues":[{issue},{issue}] //see definition below
}
//Issue definition
{
"title":"A nasty bug",
# Build Passes
curl -d "room_id=ourRoom&from=BuildBot&message=Build+Status:+Passing&color=green" https://api.hipchat.com/v1/rooms/message?auth_token=AUTH_TOKEN_HERE&format=json
# Build Fails
curl -d "room_id=ourRoom&from=BuildBot&message=Build+Status:+Failing&color=red&notify=1" https://api.hipchat.com/v1/rooms/message?auth_token=AUTH_TOKEN_HERE&format=json
@giastfader
giastfader / gist:9053882
Created February 17, 2014 16:29
Import StackMob data into BaasBox
import codecs #to manage unicode files
import json #to manipulate JSON objects
import datetime #to manipulate and format timestamps
import requests #to call BaasBox APIs
import base64 #to encode the Basic Auth header
baasbox_address = "http://localhost:9000/" #the BaasBox server address. NOTE: be sure to add the / at the end of the URL
baasbox_admin_user = "admin" #the BaasBox user to use when a BaasBox is called
baasbox_admin_password = "admin" #the password to use
baasbox_app_code = "1234567890" #the BaasBox instance application code