Skip to content

Instantly share code, notes, and snippets.

Lauro Moraes subversivo58

Block or report user

Report or block subversivo58

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
@subversivo58
subversivo58 / custom-error.js
Created Jun 23, 2019 — forked from justmoon/custom-error.js
Creating custom Error classes in Node.js
View custom-error.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@subversivo58
subversivo58 / fence.js
Created Jul 17, 2018 — forked from bmoren/fence.js
HTML5 geolocation geofence location detection (without geofence API)
View fence.js
window.onload = function() {
var startPos;
var startPosLat;
var startPosLong;
var distance;
if (navigator.geolocation) {
startPosLat = 44.95716993150707;
startPosLong = -93.28439280496818;
@subversivo58
subversivo58 / gist:4fdcd3739d74e631d1c03827ad513e8c
Created Mar 21, 2018 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:4fdcd3739d74e631d1c03827ad513e8c

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@subversivo58
subversivo58 / GithubApiPush.js
Last active Mar 15, 2018 — forked from iktash/GithubApiPush.js
Upload blob binary data to your repository
View GithubApiPush.js
/**
* Uses the GitHub library https://github.com/github-tools/github library under the hood and exposes it as `gh` property
* @see issue https://github.com/github-tools/github/issues/417
* @see bellow post https://medium.freecodecamp.org/pushing-a-list-of-files-to-the-github-with-javascript-b724c8c09b66
*/
const GithubAPI = function(auth) {
let repo,
filesToCommit = [],
currentBranch = {},
newCommit = {},
@subversivo58
subversivo58 / sendBeacon.js
Created Mar 11, 2018
navigator.sendBeacon aproach
View sendBeacon.js
/**
* SendBeacon - beaultifull unopinated aproach
* @param {String} uri - target URL (absolute or relative)
* @param {Object} data - JavaScript {Object} to serialize with `JSON.stringify()`
* @param {String} auth - optional server authentication key/nonce to request (merge to data)
*/
function Beacon(uri, data, auth = false) {
// is Chrome?
let isChrome = !!window.chrome && !window.opera || !navigator.userAgent.indexOf(' OPR/') >= 0
try {
@subversivo58
subversivo58 / is-private-mode.js
Last active Jan 24, 2018 — forked from jherax/is-private-mode.js
Detect if a browser is in Private Browsing mode
View is-private-mode.js
/**
* Detect if the browser is running in Private Browsing mode
*/
function isPrivateMode() {
return new Promise((resolve) => {
const on = () => resolve(true); // is in private mode
const off = () => resolve(false); // not private mode
const testLocalStorage = () => {
try {
if (localStorage.length) off();
@subversivo58
subversivo58 / custon-input.css
Created Dec 29, 2017
Bootstrap v4 Beta-2 add filename in custom input file
View custon-input.css
.custom-file,
.custom-file-control,
.custom-file-input {
height: 2.3rem!important;
}
/* add FontAwesome icon for input (optional) */
.custom-file-control::before {
font-family: 'FontAwesome';
content: "\f03e"!important;
height: 2.3rem!important;
View Android-Notification-Example.js
/**
* @see font: https://developer.android.com/guide/topics/ui/notifiers/notifications.html
*/
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle("My notification")
.setContentText("Hello World!");
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, ResultActivity.class);
@subversivo58
subversivo58 / .env
Created Oct 13, 2017
Simple wrapper to use "googleapis" in Node
View .env
HOST=mehost.com
APP_MAIL="Site Name" <memail@mehost.com>
GMAIL_APITOKEN={JSON API TOKEN}
GMAIL_APISECRET={JSON API SECRET}
View encript_session_to_mongodb.md
class HandlerSessionManager
{
      private $dbCollection;
      private $dbSession;
      private $dbName;
      private $expire;
      private $token;
      private $clean;
You can’t perform that action at this time.