Skip to content

Instantly share code, notes, and snippets.

View subversivo58's full-sized avatar
📧
For critical issues, send me an email

Lauro Moraes subversivo58

📧
For critical issues, send me an email
View GitHub Profile
@subversivo58
subversivo58 / decrypt.js
Created September 4, 2016 10:15 — forked from pradipchitrakar/decrypt.js
AES Encrypt data in php and decrypt in node js.
//require cyrpto module
var crypto=require('crypto');
//key and iv should be same as the one in encrypt.php
var decipher=crypto.createDecipheriv('aes-256-cbc','12345678901234561234567890123456','1234567890123456');
//since we have already added padding while encrypting, we will set autopadding of node js to false.
decipher.setAutoPadding(false);
// copy the output of encrypt.php and paste it below
class HandlerSessionManager
{
      private $dbCollection;
      private $dbSession;
      private $dbName;
      private $expire;
      private $token;
      private $clean;
@subversivo58
subversivo58 / .env
Created October 13, 2017 21:24
Simple wrapper to use "googleapis" in Node
HOST=mehost.com
APP_MAIL="Site Name" <memail@mehost.com>
GMAIL_APITOKEN={JSON API TOKEN}
GMAIL_APISECRET={JSON API SECRET}
/**
* @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 / custon-input.css
Created December 29, 2017 03:18
Bootstrap v4 Beta-2 add filename in custom input file
.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;
@subversivo58
subversivo58 / is-private-mode.js
Last active January 24, 2018 07:25 — forked from jherax/is-private-mode.js
Detect if a browser is in Private Browsing mode
/**
* 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 / sendBeacon.js
Created March 11, 2018 09:49
navigator.sendBeacon aproach
/**
* 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 / GithubApiPush.js
Last active May 31, 2023 16:30 — forked from iktash/GithubApiPush.js
Upload a binary data to your repository
/**
* Wraper to upload binary files to GitHub repo
* Uses the modified GitHub library under the hood and exposes it as `GHInstance` property for get instance of all methods
* @note:
* -- inspired at article: @see <https://medium.freecodecamp.org/pushing-a-list-of-files-to-the-github-with-javascript-b724c8c09b66>
* -- issue (not yet resolved): @see issue <https://github.com/github-tools/github/issues/417>
* @copyright Copyright (c) 2020 Lauro Moraes <https://github.com/subversivo58>
* @license MIT License <https://github.com/subversivo58/subversivo58.github.io/blob/master/LICENSE>
*/
const GithubAPI = function(auth) {
@subversivo58
subversivo58 / gist:4fdcd3739d74e631d1c03827ad513e8c
Created March 21, 2018 04:50 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

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 / fence.js
Created July 17, 2018 08:30 — forked from bmoren/fence.js
HTML5 geolocation geofence location detection (without geofence API)
window.onload = function() {
var startPos;
var startPosLat;
var startPosLong;
var distance;
if (navigator.geolocation) {
startPosLat = 44.95716993150707;
startPosLong = -93.28439280496818;