Skip to content

Instantly share code, notes, and snippets.

View washingtonsoares's full-sized avatar
🎯
Focusing

Washington Soares washingtonsoares

🎯
Focusing
View GitHub Profile
mvn exec:java -Dexec.mainClass=chavevalor.ChaveValorServer -Dexec.args="5 9090" &
package chavevalor;
import java.util.ArrayList;
import java.util.List;
import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import chavevalor.Grafo;
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>projeto01-sd</groupId>
<artifactId>projetosd</artifactId>
<version>1.0-0</version>
<dependencies>
@washingtonsoares
washingtonsoares / utils.js
Created October 3, 2017 02:43
Funções Uteis (só one-liners)
const fact = n => n && n * fact(n-1) || 1;
const decToBin = dec => dec && dec % 2 + 10 * decToBin(0 | dec / 2) || 0;
const iif = pr => t => f => x => pr(x) ? t(x) : f(x);
const not = fn => x => !fn(x);
const or = pra => prb => x => pra(x) || prb(x);
const isArray = x => x instanceof Array;
const isPromise = x => x instanceof Promise;
const isPlainObject = x => typeof x === 'object' && x !== null && x == '[object Object]';
const isTraversable = or(isPlainObject)(isArray);
const keys = Object.keys.bind(Object);
var httpBackendMock = function() {
angular.module('httpBackendMock', ['defina-se-backoffice-ui'])
.factory('loginInterceptor', function() {
return {
request: function(config) {
if(config.url.includes('get-authenticated-user')) {
config.url = config.url + '?role=student'
console.log(config)
}
return config;
(curl localhost:1026/v1/updateContext -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
"contextElements": [
{
"type": "Product",
"isPattern": "false",
"id": "Product1",
"attributes": [
{
{
"name": "UniAlgar",
"short_name": "UniAlgar",
"icons": [{
"src": "images/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
}, {
"src": "images/icons/icon-144x144.png",
"sizes": "144x144",
@washingtonsoares
washingtonsoares / otimizacao1.mod
Last active April 18, 2017 01:00
Problemas de otimizacao
var p1;
var p2;
maximize z: 1000*p1 + 1800*p2;
s.t. rp1 : p1 <= 40;
s.t. rp2 : p2 <= 30;
s.t. rp3 : 20 * p1 + 30 * p2 <= 1200;
solve;
'use strict'
module.exports = function () {
var check = false
(function (a) {
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|
import HomeModule from './home'
describe('Home', () => {
let $rootScope, $state, $location, $componentController, $compile;
beforeEach(window.module(HomeModule));
beforeEach(inject(($injector) => {
$rootScope = $injector.get('$rootScope');
$componentController = $injector.get('$componentController');