Skip to content

Instantly share code, notes, and snippets.

View filpgame's full-sized avatar

Felipe Rodrigues filpgame

View GitHub Profile
@filpgame
filpgame / SessionController.kt
Created April 24, 2023 22:47
Class structure
class SessionController(context: Context, private val tapSession: TapSession): SessionControllerInterface {
private val activationRepository = ActivationRepository(context)
private val logger = LoggerFactory.getLogger(TAG)
internal var activationData: ActivationData? = null
override suspend fun activate(
clientId: String,
clientSecret: String
): StoneStatus {
logger.trace("activate()")
@filpgame
filpgame / import.js
Last active May 31, 2023 19:17
Importar dados da NFC-e no site do sefaz pra um arquivo csv
var array = document.querySelectorAll("#tabResult > tbody tr")
var csv = ""
csv = csv.concat("Item;Quantidade;Unidade;Valor unit.;Valor Total", "\n")
for (let index = 0; index < array.length; index++) {
const el = array[index];
var item = el.querySelector(".txtTit").textContent.trim()
var qt = el.querySelector(".Rqtd").innerText.replace("Qtde.:","").replace(",",".").trim()
var unit = el.querySelector(".RUN").innerText.replace("UN:","").trim()
var unitAmount = el.querySelector(".RvlUnit").innerText.replace("Vl. Unit.:","").replace(",",".").trim()
@filpgame
filpgame / ApnHandler.java
Last active August 23, 2019 19:13
Setting APN
public class ApnHandler {
private final static Uri APN_LIST_URI = Uri.parse("content://telephony/carriers");
private final static Uri PREFERRED_APN_URI = Uri.parse("content://telephony/carriers/preferapn");
private Context context;
public ApnHandler(Context context) {
this.context = context;
}
@filpgame
filpgame / 1-interfaces.java
Last active July 10, 2017 22:06
Delegations no Kotlin (Medium)
interface Loggable {
public void log(String message);
}
class ConsoleLogger implements Loggable {
@Override
public void log(String message) {
System.out.println("Message");
}
}
@filpgame
filpgame / MoneyEditText.kt
Created June 21, 2017 16:31
MoneyEditText Kotlin
class MoneyEditText : EditText {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
private var moneyChangeListener: OnMoneyChangeListener? = null
private val moneyTextWatcher: KTextWatcher.() -> Unit = {
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJ38QWtY9bnF/Ovbol+eLYt6cAZI7Idaq3m/Hbu+Gd9KFVkApo25AkTXeE0/UHAGgM0F1l/d0mplmpSMs31xjan9XbKw4qyxJVN7XU2Y8g6O/J2KwXbbH8614BSgVMbEQrHDPUTls3h7jaw/wsaLChE6nO87OHgEt1clF43iE113hw+7elsKtWCsPBhOu34gcJeQ426K/KVvR8kTQWGwsSEpM7vor8idZEC/0SAG2Z49pDGVXOIDfox3splWegFXOO9nmahuCJX/oaxbm3AkhywgyDQlRqpygcQQXm0RGrWNB+zcsr3AXMjyvSOxyf2BHbbE2N675J4jdIL1HJT5rh filpgame@DESKTOP-M2I1GQC
@filpgame
filpgame / x-editable-password.js
Created December 15, 2015 12:12
X-Editable changing password
var Pass = function (options) {
this.init('pass', options, Pass.defaults);
};
//inherit from Abstract input
$.fn.editableutils.inherit(Pass, $.fn.editabletypes.abstractinput);
$.extend(Pass.prototype, {
render: function () {
this.$input = this.$tpl.find('input');
@filpgame
filpgame / gist:4306087183809af02752
Created July 22, 2015 14:15
Invite all friends to like facebook page at once
// 1 - you need to get the 'data-reactid' value manually on ul (something like '.4m.0.$0.1.$1.0.0.0.0.1').
// 2 - you need to scroll down to load all friends.
// in others versions i gonna improve this.
var friends = document.querySelectorAll("ul[data-reactid='00000000000'] li");
for(i=0;i<friends.length;i++){
friends[i].children[0].click();
}
function ColoredTable($header, $data) {
// Colors, line width and bold font
$this->SetFillColor(200, 200, 200);
$this->SetTextColor(0);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0.3);
$this->SetFont('', 'B', 12);
// Header
$w = array(50, 30, 20, 90, 30, 40);