Skip to content

Instantly share code, notes, and snippets.

View xgc1986's full-sized avatar
🎯
Focusing

Javier Gonzalez xgc1986

🎯
Focusing
View GitHub Profile
@xgc1986
xgc1986 / sh
Created August 23, 2020 14:03
brew osx startup installation
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew cask install 1password
brew cask install docker
brew cask install expressvpn
brew cask install google-chrome
brew cask install phpstorm
brew cask install postman
brew cask install spotify
brew cask install sublime-text
brew cask install visual-studio-code
Date.prototype.toAtomRounded=function(){let a=this.getMonth()+1;10>a&&(a='0'+a);let b=this.getDate();10>b&&(b='0'+b);let c=this.getHours();return 10>c&&(c='0'+c),`${this.getFullYear()}-${a}-${b}T${c}:00:00${this.getAtomOffset()}`},Date.prototype.toAtom=function(){let a=this.getMonth()+1;10>a&&(a='0'+a);let b=this.getDate();10>b&&(b='0'+b);let c=this.getHours();10>c&&(c='0'+c);let d=this.getMinutes();10>d&&(d='0'+d);let e=this.getSeconds();return 10>e&&(e='0'+e),`${this.getFullYear()}-${a}-${b}T${c}:${d}:${e}${this.getAtomOffset()}`},Date.prototype.getAtomOffset=function(){let a=this.getTimezoneOffset()/-60,b='+';return 0>a&&(a=-a,b='-'),9<a&&(a=`0${a}`),`${b}0${a}:00`},Date.fromAtom=function(a){let b=a.substring(0,4),c=a.substring(5,7),d=a.substring(8,10),e=a.substring(11,13),f=a.substring(14,16),g=a.substring(17,19),h=a.substring(19,20),j=a.substring(20,22),k=a.substring(23,25),l=Date.UTC(b-0,c-1,d-0,e-0,f-0,g-0);return new Date(l-6e4*(h+(60*j+1*k)))},Date.prototype.toSimpleDate=function(){let a=this.getMont
@xgc1986
xgc1986 / pm-testscript.js
Last active April 24, 2018 20:32
Postman test script
let response=null;function getId(){return response.id}function storeResponseValue(a,b,c){b===void 0&&(b=b||a),c=c||getJsonResponse(),pm.environment.set(a,response[b])}let host=pm.environment.get('host'),isLocal=host.startsWith('http://');isLocal||pm.test('Response time is less than 1s',()=>{pm.expect(pm.response.responseTime).to.be.below(1e3)});function checkStatus(a){pm.test(`Status code is ${a}`,()=>{pm.response.to.have.status(a)})}function checkEmptyResponse(){pm.test('Response should be empty',()=>{pm.response.to.not.be.withBody})}function checkNotEmptyResponse(){pm.test('Response should not be empty',()=>{pm.response.to.be.withBody})}function checkIsJson(){if(!response)try{response=JSON.parse(responseBody),pm.test('Response is a JSON',()=>{pm.expect(!0).to.be.equal(!0)})}catch(a){pm.test('Response is a JSON',()=>{pm.expect(!0).to.be.equal(!1)})}}function getJsonResponse(){if(!response)try{return response=JSON.parse(responseBody),response}catch(a){throw console.error('Invalid JSON response.'),'Invalid JSO
@xgc1986
xgc1986 / CarbonController.php
Last active September 7, 2017 17:44
xgc-php-samples-carbon-bundle-1
<?php
/**
* @Route("/")
* @Method({"GET", "POST"})
* @Template()
*
* @param Request $request
*
* @return array|RedirectResponse
*/
@xgc1986
xgc1986 / PilotFlow.cpp
Created December 8, 2014 21:03
Alg problem
#import <iostream>
#import <list>
#import <vector>
#include <algorithm>
using namespace std;
typedef vector< vector<int> > matrix;
class Network
{
/*
* Copyright 2013 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software