Skip to content

Instantly share code, notes, and snippets.

View aron-bordin's full-sized avatar

Aron Bordin aron-bordin

View GitHub Profile
@aron-bordin
aron-bordin / epubcordova.js
Last active January 20, 2016 19:05
Download and open ePubjs with Cordova/Phonegap on Android - http://goo.gl/iW26Dt
download: function(book, uri){
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
fileSystem.root.getFile("Book/" + book.file_name, {
create : true,
exclusive : false
}, function(fileEntry) {
localPath = fileEntry.toURL();
ft = new FileTransfer();
ft.download(uri, localPath, function(entry) {
getBook(entry);
@aron-bordin
aron-bordin / hello.ino
Created January 28, 2015 14:08
16x16 Dot LED Matrix Display Arduino Hello World
/**
*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#include "TimerObject.h"
TimerObject *timer1 = new TimerObject(1000); //use two hours here
TimerObject *timer2 = new TimerObject(1000); //use 6 hours
TimerObject *timer3 = new TimerObject(1000); //two minutes
void setup() {
Serial.begin(9600);
@aron-bordin
aron-bordin / led letter list.ino
Created February 12, 2015 13:22
Example on how to show a list of letters with LED matrix on Arduino
#include "TimerObject.h"
#include "LedMatrixObject.h"
TimerObject *timer = new TimerObject(1000); //change letter each second
LedMatrixObject *led = new LedMatrixObject(2, 3, 4, 5, 6, 7, 8, 9);
int letterId = 0; //you can set a number to represent each leter. You check this number on loop()
int letterList[] = {0, 4, 2, 10}; //list of letters in order
@aron-bordin
aron-bordin / AppActivity.java
Created April 17, 2015 17:18
AppActivity.java for Cocos2d-js and Google Play Services
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
__version__ = '1.0'
from kivy.app import App
from kivy.uix.label import Label
from plyer import uniqueid
class TestAndroidID(App):
def build(self):
return Label(text=str(uniqueid.id))
@aron-bordin
aron-bordin / SentimentMallet.java
Created May 4, 2015 00:21
Sentiment NLP with Mallet
package com.aronbordin;
import ca.uwo.csd.ai.nlp.kernel.LinearKernel;
import ca.uwo.csd.ai.nlp.mallet.libsvm.SVMClassifierTrainer;
import cc.mallet.classify.*;
import cc.mallet.pipe.*;
import cc.mallet.pipe.iterator.CsvIterator;
import cc.mallet.types.Instance;
import cc.mallet.types.InstanceList;
import cc.mallet.util.Randoms;
@aron-bordin
aron-bordin / customaction.py
Created May 28, 2015 22:40
Get ActionGroup from ActionButton - Kivy
class CustomActionView(ActionView):
def get_group(self, item):
'''Get the ActionGroup of a item
'''
for group in self._list_action_group:
if item in group.list_action_item:
return group
return None
@aron-bordin
aron-bordin / listable.py
Last active August 29, 2015 14:22
Selectable Kivy-garden RecycleView experiment
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.behaviors import CompoundSelectionBehavior
from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.app import App
from recycleview import RecycleView
from kivy.properties import ObjectProperty
@aron-bordin
aron-bordin / fish.sh
Last active August 29, 2015 14:23
fish.config
function fish_prompt
if test -z $WINDOW
printf '{%s%s%s at %s%s%s%s%s%s%s}$ ' (set_color "#FFFF00") (whoami) (set_color "#00FF00") (set_color "#FFFF00") (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (prompt_pwd)(set_color "#FFFF00") (__fish_git_prompt) (set_color normal)
else
printf '{%s%s%s at %s%s%s(%s)%s%s%s%s}$ ' (set_color "#FFFF00") (whoami) (set_color "#00FF00") (set_color "#FFFF00") (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (echo $WINDOW) (prompt_pwd)(set_color "#FFFF00") (__fish_git_prompt) (set_color normal)
#printf '%s%s at %s%s%s(%s)%s%s%s$ ' (set_color white) (whoami) (set_color purple) (hostname|cut -d . -f 1) (set_color white) (echo $WINDOW) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
end
end
function fish_greeting