Skip to content

Instantly share code, notes, and snippets.

View georgeportillo's full-sized avatar
🎯
Focusing

George Portillo georgeportillo

🎯
Focusing
View GitHub Profile
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);
}
// From:
{
"output": [{
"type": "text",
"template": "text",
"text": ""
}, {
"type": "card",
"template": "card",
"title": "Card #1",
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);
}
}
}
var linked_tree = [{
id: '1-abc'
value: '...'
}, {
id: '2-abc',
parent: '1-abc',
value: '...'
}, {
id: '2-def',
parent: '1-abc',
// I have this:
var data = `{
name: "foo"
}`;
apiWrapper.getCredentials(botId)
.then(function(credentials) {
apiWrapper.createIntent(credentials, data)
.then(intent => {
@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
}