Skip to content

Instantly share code, notes, and snippets.

@iannsp
iannsp / CopyPaste.js
Last active November 4, 2016 14:50
This is a laboratory just to show a first implementation (focus on "just work", urge for improvments)
'use strict';
var isArray = require('lodash/lang/isArray'),
forEach = require('lodash/collection/forEach'),
map = require('lodash/collection/map'),
find = require('lodash/collection/find'),
findIndex = require('lodash/array/findIndex'),
sortBy = require('lodash/collection/sortBy'),
reduce = require('lodash/collection/reduce');
_ _ _ ____ _ _
| | | | __ _ ___| | __ | __ ) __ _ ___| | _| |
| |_| |/ _` |/ __| |/ / | _ \ / _` |/ __| |/ / |
| _ | (_| | (__| < | |_) | (_| | (__| <|_|
|_| |_|\__,_|\___|_|\_\ |____/ \__,_|\___|_|\_(_)
Um Guia Faça Você Mesmo
@iannsp
iannsp / testItemCollection.php
Created May 10, 2014 23:41
Tests para uma collection de Items a ser utilizada em um carrinho de compras
<?php
namespace Ecomz\Cart;
class ItemCollectionTest extends \PHPUnit_Framework_TestCase{
public function testCannotAcceptNonItemItems()
{
}
public function testCannotAcceptDuplicatedItems()
@iannsp
iannsp / usage_example_for_EcomzPayment_bundle.php
Last active August 29, 2015 13:57
A study/usage case for Ecomz\Payment Bundle
<?php
$config = new Config();
// empty configuration just for example
$config->fromArray(array());
$payment = new Payment($config);
/* this is a BankBillet payment Operation using the Supported Service Provider named PaymentProvider. The obligatory data are the UPPERCASE ONE's.
always need a client identifier, so CLIENTID
always need a Service Provider, so PROVIDER (initial configuration can provide a default provider)
always need a Service Provider Method for perform the payment, so METHOD (example: BankBillet, CreditCard, DebitCard)
exports.rulesetExtracaoPropriedades = {
returnType:function(data){
//coisas que ningume pode ser. Entidade Pessoa.
negative = Array("born","album","is","an","album","by","and","released","in","Wikipedia","the",
"encyclopedia","en","wikipedia","org","wiki","footballer","Wikipedia","da","born","10","April","1973",
"more","commonly","known","simply","as","is","a","and","who","currently","Wikipedia","the","encyclopedia","en",
"wikipedia","org","wiki","Wikipedia","is","a","Grammy","Award","and","who","has","achieved","a","deal","of","and",
"recognition","in","his","50","year","Music","Biography","Credits","and","Discography","AllMusic","www","allmusic","com",
"mn0000292011","AllMusic","Find","bio","songs","credits","awards","similar","and","video","information","on","AllMusic",
"whose","dominance","of","and","Players","with","the","10","Hardest","Shots","in","Football","History","Bleacher","Report",
@iannsp
iannsp / passos_experimento_frequencia.txt
Last active August 29, 2015 13:56
Este é um arquivo que descreve o passo a passo e resultados de um experimento de uso de frequencia de tokens em resumos de links do resultado de busca do google para extração de propriedades relevantes a entidades pessoa.
Experimento 1: Classificação de entidade por frenquencia em resultados resumidos de pesquisas.
entidade: Roberto Carlos
search: https://encrypted.google.com/search?hl=en&q=roberto%20carlos
Resultados da Primeira Página:
Roberto Carlos (footballer) (born 1973) Brazilian former footballer
Roberto Carlos (singer) (born 1941) Brazilian singer
@iannsp
iannsp / greetings.js
Last active August 29, 2015 13:56
A Simple RuleSte to Say Hello based on time of the day. Use RulezB to process this ruleset: // https://www.npmjs.org/package/rulezb
exports.greetings = {
returnType:'text',
rules:[
function(data){
d = new Date();
hour = d.getHours();
if(hour >=0 && hour <= 11){
return "Good Morning "+ data.name;
}else if(hour > 11 && hour <= 17){
return "Good Afternoon "+ data.name;

Factories e Interfaces no Respect\Config

Oi de novo! Dia produtivo. Temos novas funcionalidades no Respect\Config também:

Factories e Builders

O Respect\Config gerencia as configurações de seus objetos, incluindo quem depende de quem.

@iannsp
iannsp / github-sh-issue.md
Created July 27, 2012 21:16
issue / issues command in github-sh

set command

  • set the session data
github-sh>set username iannsp
github-sh>set project github-sh

issue command

@iannsp
iannsp / description_phptag.md
Created July 26, 2012 04:10
phptag services.md

kick PHP information source

phptag is a service to provide references to sources about PHP. phptag also permit kick into this sources, using buttons into sources sites(clicking in a blog post, for instance)

the user, to have a valid kick, need login and such thing are done using some external api, probably twitter api. without login system.

the kick uri are: kick