Skip to content

Instantly share code, notes, and snippets.

View demetriusnunes's full-sized avatar

demetriusnunes demetriusnunes

  • OLX
  • Rio de Janeiro, Brazil
View GitHub Profile
@demetriusnunes
demetriusnunes / crawl.pseudo
Last active October 8, 2020 17:33
------------------------------
import List, Queue, Hash from lang.data
import fetch, normalize_url from http.utils
import write_file from lang.io
function crawl(start_url) {
crawled = new List
queue = new Queue
visited = new Hash
start_url = normalize_url(start_url)
@demetriusnunes
demetriusnunes / Component.js
Created December 18, 2015 18:49
Concise component definition for AngularJS 1.x
'use strict';
angular.module('Component', [])
.factory('Component', function () {
return function(bindings, template, linkFn, options) {
var directive = {
scope: parseBindings(bindings),
template: parseTemplate(template),
link: linkFn
@demetriusnunes
demetriusnunes / angularExtensions.js
Last active August 29, 2015 14:04
Extending $q promises with a .set method
angular.module("myApp")
.config(function ($provide) {
$provide.decorator('$q', function($delegate) {
var defer = $delegate.defer;
$delegate.defer = function() {
var deferred = defer();
deferred.promise.set = function(object, property) {
return deferred.promise.then(function(value) {
object[property] = value;
@demetriusnunes
demetriusnunes / rootScope.js
Last active August 29, 2015 13:58
Extending $scope
angular.module("myApp").run(function ($rootScope) {
var proto = Object.getPrototypeOf($rootScope);
angular.extend(proto, {
$waitFor: function (expression, fn) {
var un = this.$watch(expression, function (value) {
if (value === undefined) return;
un();
return fn(value);
});
angular.module('ProductsService', []).factory('Products', ['$http', function ($http) {
return {
get: function () {
return $http.get('/api/products');
},
create: function (data) {
return $http.get('/api/products', data);
},
@demetriusnunes
demetriusnunes / robot.js
Created December 10, 2012 20:53 — forked from p7o/robot.js
Gunkerzer
//FightCode can only understand your robot
//if its class is called Robot
var direction = 1;
var moveStep = 7;
var rotateStep = 1;
var initialized = false;
var noScanCount = 0;
@demetriusnunes
demetriusnunes / robot.js
Created December 3, 2012 13:01
W00t #1 YEAH!!!! (Zolmesiter)
var Robot = function(robot){
robot.turnLeft(robot.angle % 90);
//robot.turnGunRight(90);
robot.clone();
this.direction = 1;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(1);
if (robot.parentId) {
@demetriusnunes
demetriusnunes / core.clj
Created October 17, 2011 17:51
Validador de redirects em clojure
(ns ego-checker.core
(:require [clj-http.client :as http]
[clojure.data.csv :as csv]
[clojure.java.io :as io]))
(def *file-urls* "lista-urls.txt")
(def *log-file-path* "error.log")
(defn test-url [url]
(try (let [resp (http/get url {:follow-redirects false})]
Using org.netbeans.jemmy.drivers.DefaultDriverInstaller driver installer
It takes a while for the scenarios to begin executing, so please be patient...
Source: button_steps.rb:1
I click the button "([^\"]*)"
I click the button "([^\"]*)" no block
Source: checkbox_steps.rb:1
I click the checkbox "([^\"]*)"
the checkbox "([^\"]*)" should (not )*be selected
Funcionalidade: Buttons locators and events
Cenario: Button clicking
Dado the frame "SwingSet" is a container
E the toolbar button "#1" is selected
E the tab "Button Demo" is a container
Quando eu clicar no botão "One"
Quando eu clicar no botão "Two"
Quando eu clicar no botão "Three!"