Skip to content

Instantly share code, notes, and snippets.

View xavi-tristancho's full-sized avatar

Xavier Tristancho Bordoy xavi-tristancho

View GitHub Profile
import { now, add } from "moment";
const tomorrow = add(now(), "1", "day");
import moment from "moment";
const tomorrow = moment().add("1", "day");
//algebra.js
export function sum(x,y) {
return x + y
}
export function times(x,y) {
return x*y
}
//calculadora.js
@xavi-tristancho
xavi-tristancho / buddypress_paidmembershipspro_account_tab.php
Last active April 12, 2018 16:43
Add a new tab to the buddypress profile showing paidmemberships pro account information
function buddypress_paidmembershipspro_account_tab()
{
global $bp;
bp_core_new_nav_item(array(
'name' => 'Account',
'slug' => 'account',
'parent_url' => bp_displayed_user_domain() . '/account/',
'parent_slug' => $bp->profile->slug,
'default_subnav_slug' => 'account',
'position' => 100,
//Antes teníamos que usar promesas o callbacks
const fetch = require('fetch');
function fetchFruitName(fruitId) {
return fetch(`https://api.fruits.com/fruit/${fruitId}`)
.then(response => response.json())
.then(fruit => fruit.name);
}
const fruitName = fetchFruitName(1);
const fruit = { name: 'orange', weight: '1000' };
Object.entries(fruit); // [['name', 'orange'],['weight','1000']]
const fruit = { name: 'orange', weight: '1000' };
Object.values(fruit); // ['orange', '1000']
curl 'http://localhost:1024/api/find' -H 'Pragma: no-cache' -H 'Origin: http://localhost:1024'
-H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en,es;q=0.8,gl;q=0.6'
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/51.0.2704.103 Safari/537.36' -H 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT'
-H 'Content-Type: application/json' -H 'Access-Control-Allow-Origin: *' -H 'Accept: application/json'
-H 'Cache-Control: no-cache' -H 'Referer: http://localhost:1024/affiliate/account?code=AV001939'
-H 'Cookie: ajs_anonymous_id=%22d7206d98-3313-4e0a-8eed-75362cb26869%22; __atuvc=10%7C23;
__utma=111872281.668073671.1464000517.1465823221.1465890868.3;
__utmz=111872281.1465823221.2.2.utmcsr=kanban.apploading.com|utmccn=(referral)|utmcmd=referral|utmcct=/boards/openmarket.travel/marcablanca/issues/10;
connect.sid=s%3A2eTSZG46LN6fr7Q_JdVCpzfg3RyeUpyu.fpj2MuF9WHea1pZsZhEkeAlp%2BhzUw%2FoK7kW67%2BRpPGM; _ok=6680-635-10-9090; currentUserEmail=%
POST /v2/professionals/jobs/983567 HTTP/1.1
Host: mapi.habitissimo.mobi.test
Accept: */*
Authorization: Bearer ZS5pnUuWK7xr0zjGcOujVAOHusWlR8
Accept-Encoding: gzip, deflate
Accept-Language: es-ES;q=1, en-ES;q=0.9
X-Habit-AppVersion: 1.1.2/iOS
Content-Type: application/json
Content-Length: 24
User-Agent: HABITISSIMO/1.1.2 (iPhone; iOS 9.1; Scale/2.00)
module.exports = function(ngModule) {
IndexCustomersController.prototype = Object.create(BaseController.prototype);
function IndexCustomersController(Api)
{
var vm = this;
vm.getAll = function()
{