Skip to content

Instantly share code, notes, and snippets.

View jnplonte's full-sized avatar

John Paul Onte jnplonte

View GitHub Profile
@jnplonte
jnplonte / jnplonte
Last active July 28, 2023 06:32
vs-code settings
{"name":"jnplonte","settings":"{\"settings\":\"{\\n\\t\\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\n\\t\\\"workbench.colorTheme\\\": \\\"Monokai Dimmed\\\",\\n\\t\\\"prettier.singleQuote\\\": true,\\n\\t\\\"prettier.printWidth\\\": 120,\\n\\t\\\"prettier.useTabs\\\": true,\\n\\t\\\"editor.suggestSelection\\\": \\\"first\\\",\\n\\t\\\"vsintellicode.modify.editor.suggestSelection\\\": \\\"automaticallyOverrodeDefaultValue\\\",\\n\\t\\\"tabnine.experimentalAutoImports\\\": true,\\n\\t\\\"editor.defaultFormatter\\\": \\\"esbenp.prettier-vscode\\\",\\n\\t\\\"workbench.editorAssociations\\\": {\\n\\t\\t\\\"*.ipynb\\\": \\\"jupyter-notebook\\\"\\n\\t},\\n\\t\\\"extensions.ignoreRecommendations\\\": true,\\n\\t\\\"[dart]\\\": {\\n\\t\\t\\\"editor.formatOnSave\\\": true,\\n\\t\\t\\\"editor.formatOnType\\\": true,\\n\\t\\t\\\"editor.rulers\\\": [80],\\n\\t\\t\\\"editor.selectionHighlight\\\": false,\\n\\t\\t\\\"editor.suggest.snippetsPreventQuickSuggestions\\\": false,\\n\\t\\t\\\"editor.suggestSelection\
@jnplonte
jnplonte / logs1
Created December 23, 2021 15:45
logs1
"data": [
{
"_id": "61c465b0545e8c424bb9b39e",
"userEmail": "joe_li@hi-speed",
"customerId": "60d3ee22cad3a6f28744f6cf",
"companyId": "logflows-577",
"type": "LASTMILE",
"logType": "NORMAL",
"orderId": "61c450f1545e8c424bb9ab0c",
"code": "2021-12-24",
@jnplonte
jnplonte / firebase-reg
Created November 1, 2021 04:16
firebase-reg
<template>
<h1> Create an Account </h1>
<p> <input type='text' placeholder="Email" v-model='email'/> </p>
<p> <input type='password' placeholder="Password" v-model='password'/> </p>
<p> <button @click="register"> Submit </button> </p>
</template>
<script>
import { ref } from 'vue'
import firebase from 'firebase'
@jnplonte
jnplonte / strat.sh
Created May 26, 2020 05:53
HTTP SERVER
#!/usr/bin/env bash
# Create a page in the current dir
echo "My Test Page" > test.html
# Start server
python -m SimpleHTTPServer 8000 &> /dev/null &
pid=$!
# Give server time to start up
@jnplonte
jnplonte / python-s3.py
Created February 1, 2018 09:49
python aws s3 full implementation
#!/usr/bin/env python2.7
import copy
import boto3
import botocore
def python_s3(name='', base='', config={}, **kwargs):
config = copy.deepcopy(config)
s3 = boto3.resource(
@jnplonte
jnplonte / python-s3-read.py
Created February 1, 2018 09:41
python aws s3 read
import boto3
path = "hello.txt"
# if you want to put the file on a folder you can to it like this
#path = "some-path/another-path/hello.txt"
s3 = boto3.resource(
's3',
aws_access_key_id=<AWS-ACCESS-KEY>,
aws_secret_access_key=<AWS-SECRET-KEY>
@jnplonte
jnplonte / python-s3-upload.py
Last active February 1, 2018 09:40
python aws s3 upload
import boto3
data = "hello world!"
path = "hello.txt"
# if you want to put the file on a folder you can to it like this
#path = "some-path/another-path/hello.txt"
s3 = boto3.resource(
's3',
@jnplonte
jnplonte / custom-encode-decode.js
Created May 31, 2017 06:36
custom base64 encode and decode for javascript
var base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r
@jnplonte
jnplonte / encode-decode.js
Last active May 31, 2017 06:35
base64 encode and decode for javascript
// Define the string
var string = 'john paul onte';
// Encode the String
var encodedString = btoa(string);
console.log(encodedString); //output: "am9obiBwYXVsIG9udGU="
// Decode the String
var decodedString = atob(encodedString);
console.log(decodedString); // output: "john paul onte"
@jnplonte
jnplonte / ng-numbers-only
Last active August 29, 2015 14:18
ng-numbers-only
<html lang="en-US" class="no-js" ng-app="ngApp">
<head>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js'></script>
<script type='text/javascript'>
var app = angular.module('ngApp', []);
app.directive('numbersOnly', function () {
return {
require: 'ngModel',
link: function (scope, element, attr, ngModelCtrl) {
function fromUser(text) {