Skip to content

Instantly share code, notes, and snippets.

View djalmajr's full-sized avatar

Djalma Júnior djalmajr

View GitHub Profile
@djalmajr
djalmajr / README.md
Created September 30, 2017 18:22 — forked from lokothodida/README.md
Small bookmarklet to help change app drawer icons for Chrome OS web apps
  • Create a bookmark with the following text in the URL field:
javascript:(function() {
  var links = document.querySelectorAll('link[rel*=icon]');
  var href  = prompt('Enter your new shelf icon\'s URL');
  href && links.forEach((link) => link.href = href);
})();
import QtQuick 2.4
Column {
width: parent.width
height: parent.height
property alias model: columnRepeater.model
Repeater {
id: columnRepeater
@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
*/
@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
(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 {
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;
@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") {
@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 / 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 / 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;
},