Skip to content

Instantly share code, notes, and snippets.

View djalmajr's full-sized avatar

Djalma Júnior djalmajr

View GitHub Profile
@djalmajr
djalmajr / csv2bib.sh
Last active April 16, 2020 18:04
SpringerLink CSV to BIB converter
#!/bin/bash
# csv2bib.sh
#
# SpringerLink CSV to BIB
#
# Author: Djalma Jr.
# Site: djalmajr.com
#
# v0.3.0: Updated download link
# v0.2.0: Added command line options
@djalmajr
djalmajr / loader-1.html
Created November 20, 2018 15:37
App Loader
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>App Loader</title>
<style media="screen">
html,
body {
background-color: #F2F2F4;
}
@djalmajr
djalmajr / router.js
Last active November 3, 2018 17:57
Tiny Router lib
var Router = {
routes: [],
mode: null,
root: '/',
config: function(options) {
this.mode = options && options.mode && options.mode == 'history'
&& !!(history.pushState) ? 'history' : 'hash';
this.root = options && options.root ? '/' + this.clearSlashes(options.root) + '/' : '/';
return this;
},
@djalmajr
djalmajr / router.html
Created November 3, 2018 16:29 — forked from joakimbeng/router.html
A really simple Javascript router
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building a router</title>
<script>
// Put John's template engine code here...
(function () {
// A hash to store our routes:
@djalmajr
djalmajr / dom-helpers.js
Created October 6, 2018 14:46
DOM Helpers
(() => {
window.createElement = (name, attrs = {}) => {
const element = document.createElement(name);
Object.keys(attrs).forEach(key => (element[key] = attrs[key]));
return element;
};
window.loadStyle = href => {
return new Promise((onload, onerror) => {
const style = createElement("link", { onload, onerror, href, rel: "stylesheet" });
@djalmajr
djalmajr / console-save.js
Created October 2, 2018 00:45
console.save
(function(console) {
console.save = function(data, filename) {
if (!data) {
console.error("Console.save: No data");
return;
}
if (!filename) filename = "console.json";
if (typeof data === "object") {
import { html, render } from "https://unpkg.com/lit-html?module";
export * from "https://unpkg.com/lit-html?module";
export function createProperty(prototype, propertyName, options = {}) {
if (!prototype.constructor.hasOwnProperty("properties")) {
Object.defineProperty(prototype.constructor, "properties", { value: {} });
}
prototype.constructor.properties[propertyName] = options;
(function(){ //make __dirname, __filename work in the browser
if(window && !window['__dirname']){
var stackTrace = function () {
var lines = (new Error()).stack.split("\n");
// 0 = message, 1 = stackTrace
lines.shift(); lines.shift();
var result = lines.map(function(line){
if(line.indexOf('(native)') != -1){
return {
@djalmajr
djalmajr / policy.html
Created August 5, 2018 21:04
Privacy Policy
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Privacy Policy</title> <style>body{font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; padding:1em;}</style></head> <body><h2>Privacy Policy</h2> <p> Audora built the OAB AL app as a Free app. This SERVICE is provided by Audora at no cost and is intended for use as is.
</p> <p>This page is used to inform website visitors regarding our policies with the collection, use, and
disclosure of Personal Information if anyone decided to use our Service.
</p> <p>If you choose to use our Service, then you agree to the collection and use of information in relation
to this policy. The Personal Information that we collect is used for providing and improving the
Service. We will not use or share your information with anyone except as described
in this Privacy Policy.
</p> <p
@djalmajr
djalmajr / Toast.qml
Created July 10, 2018 13:17 — forked from jonmcclung/Toast.qml
Toast in QML. This implementation creates black toast with white text that appears at the bottom of the screen. It also supports adding multiple toast at a time using ToastManager with the newest toast at the bottom.
import QtQuick 2.0
/**
* adapted from StackOverflow:
* http://stackoverflow.com/questions/26879266/make-toast-in-android-by-qml
*/
/**
* @brief An Android-like timed message text in a box that self-destroys when finished if desired
*/