Skip to content

Instantly share code, notes, and snippets.

View georgeportillo's full-sized avatar
🎯
Focusing

George Portillo georgeportillo

🎯
Focusing
View GitHub Profile
@georgeportillo
georgeportillo / ViewController.swift
Created July 5, 2016 19:31
How to pass more parameters/arguments into action?
func someFunction() {
var i = "Hello world"
cell.likeButton.addTarget(self, action: #selector(ViewController.likePost), forControlEvents: .TouchUpInside)
}
func likePost(likeButton: UIButton) {
print(?) // Hello world
}
// I have this:
var data = `{
name: "foo"
}`;
apiWrapper.getCredentials(botId)
.then(function(credentials) {
apiWrapper.createIntent(credentials, data)
.then(intent => {
var linked_tree = [{
id: '1-abc'
value: '...'
}, {
id: '2-abc',
parent: '1-abc',
value: '...'
}, {
id: '2-def',
parent: '1-abc',
if(single_message.message && single_message.message.quick_reply) {
if(single_message.message.quick_reply.payload) {
if(single_message.message.quick_reply.payload.includes('event')) {
payload = JSON.parse(single_message.message.quick_reply.payload);
}
}
}
// From:
{
"output": [{
"type": "text",
"template": "text",
"text": ""
}, {
"type": "card",
"template": "card",
"title": "Card #1",
service.expand = function(input) {
let output = [];
let tempArray = input.slice();
tempArray.forEach((data, index) => {
if(data.length > 0) {
output.push.apply(output, data);
} else {
output.push(data);
}
{
"entry": [{
"id": "39067632506",
"time": 1489304167705,
"messaging": [{
"sender": {
"id": "1713278708698563"
},
"recipient": {
"id": "39067632506"
////
// Get started
// This is a webhook postback with event (an event determines which API.ai intent
// will fire when a button with an event payload is clicked).
// See example: http://i.imgur.com/jPFHuZ2.png (see events, in this case, the
// getstarted intent will fire because in the payload, the event is getStarted.
// It's like a unique identifier.
////
{
"entry": [{
// Simulate get started
{
"entry": [{
"id": "<PAGE_ID>",
"time": 1489304167705,
"messaging": [{
"sender": {
"id": "<USER_ID>"
},
"recipient": {
find . -maxdepth 2 | # Find files
grep ".html" | # Grep for all html files
xargs -I % grep "\"solution-apis-used_list_item\"" % | # Search for a string in those files
wc -l # Return number of found instances