Skip to content

Instantly share code, notes, and snippets.

@rafaelportela
rafaelportela / default.pp
Created June 30, 2015 22:10
Puppet script to install java automatically accepting licences
file { '/etc/apt/sources.list.d/webupd8team.list':
content => "deb http://ppa.launchpad.net/webupd8team/java/ubuntu lucid main\ndeb-src http://ppa.launchpad.net/webupd8team/java/ubuntu lucid main\n",
} ->
exec { 'add-webupd8-key':
command => 'apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886',
path => ['/usr/bin/', '/bin'],
} ->
exec { 'apt-key-update':
@rafaelportela
rafaelportela / homepage.js
Created September 17, 2014 10:29
[Protractor Meetup] (angular/tests/Pages/homepage.js) Page object file
var homePage = function() {
this.getPageTitle = function() {
return element(by.tagName('h1')).getText();
};
this.searchArtist = function(artist) {
var searchfield = element(by.css("#search-field"));
searchfield.sendKeys(artist);
};
@rafaelportela
rafaelportela / spec.js
Last active August 29, 2015 14:06
[Protractor Meetup] (angular/tests/spec.js) Test spec file
homePage = require('./Pages/homepage.js');
describe('Angularjs Search feature',function() {
describe('Search page', function() {
beforeEach(function(){
browser.get('http://localhost:8000/');
});
import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.VCARD;
import static com.hp.hpl.jena.query.QueryExecutionFactory.*;
public class Main {
@rafaelportela
rafaelportela / robot.js
Created December 8, 2012 13:23
Portela
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {};
var R = Robot.prototype;
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(10);
robot.turn(45);
@rafaelportela
rafaelportela / OSXImage2BufferedImage.java
Created July 4, 2012 12:52
Code to get a generic BufferedImage from apple.awt.OSXImage (specific Apple Image implementation)
/**
* http://blog.pengoworks.com/index.cfm/2008/2/8/The-nightmares-of-getting-images-from-the-Mac-OS-X-clipboard-using-Java
*/
public static BufferedImage getBufferedImage(Image img){
if( img == null ) return null;
int w = img.getWidth(null);
int h = img.getHeight(null);
// draw original image to thumbnail image object and
// scale it to the new size on-the-fly
BufferedImage bufimg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
@rafaelportela
rafaelportela / draw-circles.html
Created July 1, 2012 02:40
Drawing circles on mouse clicks using jQuery
<html>
<head>
<title>Desenhando com jQuery</title>
<style>
.coord {
opacity: 0.5;
-webkit-transition: opacity .1s linear;
-moz-transition: opacity .1s linear;
@rafaelportela
rafaelportela / style_button.css
Created May 18, 2012 19:56
Applying gradient background color to submit input type, with shadow on hover
@font-face {
font-family: 'DroidSansBold';
src: url('fonts/DroidSans-Bold-webfont.eot');
src: local('☺'), url('fonts/DroidSans-Bold-webfont.woff') format('woff'), url('fonts/DroidSans-Bold-webfont.ttf') format('truetype'), url('fonts/DroidSans-Bold-webfont.svg#webfontSOhoM6aS') format('svg');
font-weight: bold;
font-style: normal;
}
#sign-up input[type="submit"] {
float: right;
@rafaelportela
rafaelportela / blocks.html
Created May 18, 2012 17:11
Using CSS3 transition to increase block width on mouse hover
<div id="wrap">
<div id="blocks">
<section id="news" class="box">
<header><h1 class="script">Latest News</h1></header>
<article class="news-post">
<header>
<h1><a href="#">Border &amp; Radius Named to City's Best List</a></h1>
</header>
<p><time datetime="2011-01-26" pubdate>Monday, January 26, 2011</time> | <span class="via">via</span> <a href="#">The Newspaper</a></p>
</article>