Skip to content

Instantly share code, notes, and snippets.

View juanbrusco's full-sized avatar
🏠
Working from home

Juan Ariel Brusco juanbrusco

🏠
Working from home
View GitHub Profile
@juanbrusco
juanbrusco / parsing-json-object.swift
Last active August 31, 2018 22:06
Parsing json objects - Swift
//JSON example
{
"ObjectList": [
{
"x": "Starbucks",
"y": "asd"
},
{
"x": "Starbucks",
"y": "asd"
@juanbrusco
juanbrusco / check-empty.js
Created August 30, 2018 19:06
Check empty - Javascript
isEmpty(myObject) {
for(var key in myObject) {
if (myObject.hasOwnProperty(key)) {
return false;
}
}
return true;
};
@juanbrusco
juanbrusco / truncate.js
Created August 30, 2018 19:02
Truncate a string - Javascript
truncate (str, length, ending) {
if (length == null) {
length = 100;
}
if (ending == null) {
ending = '...';
}
if (str.length > length) {
return str.substring(0, length - ending.length) + ending;
} else {