Skip to content

Instantly share code, notes, and snippets.

@moyarich
moyarich / Screenshot 2024-04-17 at 6.43.03 PM.png
Last active April 18, 2024 00:47
Which NPM modules are preinstalled in AWS Lambda
Screenshot 2024-04-17 at 6.43.03 PM.png
@moyarich
moyarich / create_ssl_certificate.sh
Created August 10, 2022 14:04
create ssl certificate using Openssl
#code works on macbook
#Author Moya Richards
function create_ssl_certificate(){
local cert_dir=$1
local domain_name=$2
local expire=${3:-365}
local corporation=${4:-My-Corporation}
local group=${5:-My-Corporate-Group}
local city=${6:-City}
local state=${7:-State}
@moyarich
moyarich / Queue.prototype.processOne.js
Created June 9, 2020 22:34
Implementation of a processOne function to process a single item in the queue
const Queue = require("bull");
const Job = Queue.Job;
/**
* Process only one queue at a time
* Bull has not implimented this feature
* @param callback {function(Object)} This will be called after pulling a job from the queue.
* A job will be passed as the first parameter
*
* @return {Object} The information about the next Job that is in the queue
# forward web traffic from https://api.examplewebsite.com to http://127.0.0.1:6000
#file location: /etc/nginx/conf.d/virtual.conf
server {
listen 80;
listen 443 ssl;
server_name api.examplewebsite.com;
ssl_certificate /etc/ssl/ssl_2020/certbundle.pem;
ssl_certificate_key /etc/ssl/ssl_2020/key/examplewebsite.key;
@moyarich
moyarich / 2020211_curl_7.67.0_error_verbose_data
Last active February 11, 2020 17:09
LINK to same issue: https://github.com/curl/curl/issues/4624 | Windows server 2019 - 64bit - Errors with curl 7.67.0 bundled with PHP version 7.4 - The error is found also in this version of xampp : https://www.apachefriends.org/xampp-files/7.4.2/xampp-windows-x64-7.4.2-0-VC15-installer.exe and on the site https://windows.php.net/download/
Curl version:
Array
(
[version_number] => 475904
[age] => 5
[features] => 2953117
[ssl_version_number] => 0
[version] => 7.67.0
[host] => x86_64-pc-win32
@moyarich
moyarich / postman-get-yotpo-authentication-bearer-token.js
Last active January 14, 2020 16:37
Yotpo Authentication - get bearer request token for use with postman
/**
* Yotpo Authentication This endpoint uses your Yotpo API Key and API Secret to generate the API utoken necessary to authenticate most of Yotpo's API calls.
* Note that utokens are invalidated upon logging out of the Yotpo system.
* As such, we recommend generating a new utoken for every API call.
*
* https://apidocs.yotpo.com/reference#yotpo-authentication
*
* Sample - pre request script taken from
*
* https://gist.github.com/bcnzer/073f0fc0b959928b0ca2b173230c0669
@moyarich
moyarich / mockgoose-testing-mocho
Last active October 14, 2019 19:43
mongoose mockgoose test
const assert = require("assert");
const mongoose = require("mongoose");
const Mockgoose = require("mock-mongoose").Mockgoose;
mongoose.Promise = global.Promise;
mongoose.set("useCreateIndex", true);
mongoose.set("debug", false);
describe("category connection", function() {
@moyarich
moyarich / fiddle_094751.php
Created May 26, 2017 14:35 — forked from phpfiddle/fiddle_094751.php
[ Posted by Moya ] ratings stars code any percentages as well as 1/2 stars
<style type="text/css">
.rating-frame {
width: 90px;
height: 17px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAiCAIAAADd1h6tAAACXUlEQVQ4y5VTW27aUBCdJWQJXQpLyRK6gywhS+gSKrUf5CdK04JrwCIxuGnA+IEBJwYDtpMQMI/bczEpD19LcDUajWbmeM48TEz0ptNpoViEZhmPhF7TspRqtanrJ8Dm87lcKtm2DQ37WFjbcSqKMhwOLcuCfSxMLpdN05xMJrPZLKsg9VwXn6xrGgRFCpJUrVZHo9FiseBN2vZvWcaHkgRkIp/D0HelUmk0GoZpdrvdwWAQRdFuBdhBEDiOg25r9XoyJ0qa0TQNFZCxXC5Xq1WaVRiGjWbzf6ub3rx+/75W6/f7wgH4vg+Gz54nGAmYoIf31Ir5PsplRDMniTDIHJBM1pi5AJySJMv4aro3TPjg0LYwfzgsravFcWwYBm4SGttDSNd1b6exPRhWrKqq3mqBUjIxrAi0Ldt2XRdRMQyzAgDhg6XBoyhKTdPEMNDI+lPgzyR50hPD5m9W+ztBnwYbaZ9f/pB/d34CbBmPO/kzNiZo2MfCgseLUCUWETTsY2GdqzPmEwsJGrawIEXmZdC48KScV8z1rj+1v1GgEAsIJKGjO+rmOVueIOVQPDIuOcy/Pw/LtDS4sC6vsJXBh37aJCAzmRMlzYxlYoB5xJ7X4qXEoEDetrrp7dX5MrihuL4uCOl8GGuBH1HkCEby7t/wYbSImcSsHWnx3hDNnCSHPRJr7stfDstcAE7JveJJaXHzh4e2hU2evo6uiT0Q0+j1J2ETL7fEVO4Jf+w1tgfDHcYSTQqcEjYJD1YE++0XwY+oGIZtgiTCu2cBG55enhAVw0Aj60+BP5PkSe8fk+toIJaypK8AAAAASUVORK5CYII=');
background-r
@moyarich
moyarich / slidepanel
Created February 20, 2017 15:01
slide panel - offcanvas drawer menu
SlidePanel = function(elem, options) {
var self = this; // store reference to this
this.elem = elem;
this.$elem = $(elem);
this.options = options;
this.metadata = this.$elem.data( "slidepanel-options" );
};
SlidePanel.prototype = {