Skip to content

Instantly share code, notes, and snippets.

Pedro Henriques dos Santos Teixeira pedroteixeira

Block or report user

Report or block pedroteixeira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View readme.md

Consider a information model where each record is represented by an immutable tuple. This tuple in this context is called a fact.

Example of a fact:

('john', 'age', 18, true)

In this representation, the subject (or entity) 'john' has a value of '18' associated with the attribute 'age'.

To represent a deletion (or retraction) of information, the fourth element of the tuple can be 'false' to indicate that the corresponding entity's attribute no longer has that value.

@pedroteixeira
pedroteixeira / bash
Last active Sep 26, 2018
Itau Guardiao Ubuntu 18
View bash
Baixe deb em http://www.dieboldnixdorf.com.br/warsaw/
(ou em http://guardiao.itau.com.br/warsaw/warsaw_setup_64.deb)
sudo apt install python python-openssl python-six python-cryptography python-gpg
sudo dpkg --ignore-depends=libcurl3 --ignore-depends=python-gpgme -i warsaw-setup-ubuntu_64.deb
sudo vi /usr/bin/warsaw
@pedroteixeira
pedroteixeira / prelude-js.el
Last active Aug 29, 2015
web-mode is not indenting correctly javascript (web-mode in jsx files)
View prelude-js.el
(custom-set-variables
'(web-mode-attr-indent-offset nil)
'(web-mode-code-indent-offset 2)
'(web-mode-markup-indent-offset 2)
'(web-mode-indentation-params '("lineup-calls" . nil))
)
@pedroteixeira
pedroteixeira / onbeforeunload.js
Last active Dec 27, 2015
onbeforeunload support for js navigation (via hashchange, such as backbone.history, etc)
View onbeforeunload.js
var cancelNavigate;
$(window).on("hashchange", function(ev) {
if(cancelNavigate) {
cancelNavigate = false;
return false;
}
if(window.onbeforeunload) {
var ok = confirm(window.onbeforeunload());
if(ok) {
window.onbeforeunload = null;
View robot.js
var Robot = function(robot){
robot.turnLeft(robot.angle % 90);
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
if (robot.parentId) {
robot.ahead(1);
robot.turnGunRight(1);
}
else {
@pedroteixeira
pedroteixeira / gp.clj
Created Sep 24, 2012
gaussian process regression
View gp.clj
(ns demo.gp
(:use (incanter core stats)))
(set! *warn-on-reflection* true)
(def X (matrix [-4 -3 -1 0 2]))
(def Y (matrix [-2 0 1 2 -1]))
(def X* (matrix (range -5 5 0.2040816)))
@pedroteixeira
pedroteixeira / console.rb
Created Sep 2, 2012
tip to test rails helper in console
View console.rb
class H; include MyHelper; end; h = H.new
@pedroteixeira
pedroteixeira / controller.rb
Created Aug 29, 2012
dynamic date+time acessors a datetime attribute in rails model
View controller.rb
# and you can handle formating in your controller
def action
params[:start_at] = params[:start_at_date] + ' ' + params[:start_at_time]
params.delete :start_at_date
params.delete :start_at_time
end
@pedroteixeira
pedroteixeira / form.rb
Created Aug 10, 2012
Dynamic class for Formtastic
View form.rb
class Form
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
# Subclass may provide a types hash. Any attributes not listed will
# default to string.
# self.types = {
# :description => :text,
# :state => {:type => :string, :limit => 2}
@pedroteixeira
pedroteixeira / select2.js
Created Aug 3, 2012
select2 + twitter bootstrap
View select2.js
var onscroll = function() {
var open = $(".select2-drop.select2-drop-active.select2-with-searchbox");
var originalTop = open.data('original-top');
var top = originalTop || parseInt(open.css('top'), 10);
if(!originalTop) {
open.data('original-top', top);
}
//ajust top
open.css('top', (top + $(window).scrollTop()) + 'px');
You can’t perform that action at this time.