Skip to content

Instantly share code, notes, and snippets.

curl -X POST -H "Content-Type: application/json" -d '{ <<<
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"START_MESSENGER"
}
]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=${accessToken}"
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"greeting",
"greeting":{
"text":"Bienvenido a ExpansionMX"
}
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=${ACCESS_TOKEN}"
curl -X DELETE -H "Content-Type: application/json" -d '{ <<<
"setting_type":"greeting"
@iamedu
iamedu / timezone.sql
Created August 29, 2016 01:06
Postgres start of day in custom timezone
select to_date(to_char(current_timestamp AT TIME ZONE 'America/Mexico_City', 'YYYY-MM-dd'), 'YYY-MM-DD')::timestamp AT TIME ZONE 'America/Mexico_City';

Get up and running with Foundation

Prerrequisites

  • An internet connection!
  • Terminus DB copy (data-sql-apr-15.sql.bz2)
  • Solr copy (data-solr-apr-15.sql.bz2)
  • Maven 3
  • Recommended: NVM to install node & npm
  • Node v4
var http = require('http'),
httpProxy = require('http-proxy'),
tamper = require('tamper');
var host = 'localhost:4242';
var proxy = httpProxy.createProxyServer({target:'https://' + host});
var crossdomain = '<?xml version="1.0"?> <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> <cross-domain-policy> <site-control permitted-cross-domain-policies="all"/> <allow-access-from domain="*" secure="false"/> <allow-http-request-headers-from domain="*" headers="*" secure="false"/> </cross-domain-policy>';
var clientaccesspolicy = '<?xml version="1.0" encoding="utf-8"?> <access-policy> <cross-domain-access> <!-- Silverlight 3 or higher requires the http-request-headers attribute. --> <policy> <allow-from http-request-headers="*"> <domain uri="http://*" /> <domain uri="https://*" /> </allow-from> <grant-to> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy>';
var t = tamper(function(req, res) {
@iamedu
iamedu / gist:c8d263d3e27c8e1c1fce
Created March 5, 2015 17:58
Elasticsearch with grandparents and thingies
#Based on http://techhari.blogspot.co.at/2013/05/elasticseach-routing-for-parent-child.html
#Create a new parentchild index
curl -XDELETE 'http://localhost:9200/parentchild' && echo
curl -XPUT 'http://localhost:9200/parentchild' -d '{}' && echo
#Create mapping without routing
curl -XPUT localhost:9200/parentchild/attrvalues/_mapping -d '{
"attrvalues": {
@iamedu
iamedu / gist:90e396725fe4c6014c8d
Created January 27, 2015 18:16
Mensaje para ti
# wget https://github.com/…/bo…/releases/download/2.0.0-rc8/boot.sh && mv boot.sh boot && chmod a+x boot && sudo mv boot /usr/local/bin
# boot repl
boot.user> (defn <3 [love & loves] (apply str love " <3 " (clojure.string/join " and " loves)))
boot.user> (<3 "I" "Clojure" "you")
import javax.ws.rs.Consumes
import javax.ws.rs.POST
import javax.ws.rs.core.MediaType
import org.glassfish.jersey.media.multipart.FormDataContentDisposition
import org.glassfish.jersey.media.multipart.FormDataParam
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
### Keybase proof
I hereby claim:
* I am iamedu on github.
* I am iamedu (https://keybase.io/iamedu) on keybase.
* I have a public key whose fingerprint is 529F 8101 A1E9 684D F828 6F9A 4AB8 268D F41D 083A
To claim this, I am signing this object:
@iamedu
iamedu / gist:cf129ab027785bed8dc2
Created September 21, 2014 15:27
Check phone service
import java.security.*
class PhoneHasherService {
String checkHashPhone(String phone, String hash) {
int iterations = 128
String [] hashParts = hash.split(":")