Skip to content

Instantly share code, notes, and snippets.

View manchuck's full-sized avatar
⚒️
Hacking the gibson

Chuck Reeves manchuck

⚒️
Hacking the gibson
View GitHub Profile
@manchuck
manchuck / testRegex.js
Created July 5, 2023 16:52
email regex
const isEmail = (email) => {
const regex = /(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
return regex.test(email);
}
const validEmails = [
'simple@example.com',
'very.common@example.com',
'disposable.style.email.with+symbol@example.com',
'other.email-with-hyphen@and.subdomains.example.com',
// You can use this file to test the server-sdk
const { Vonage } = require('@vonage/server-sdk')
const { tokenGenerate } = require('@vonage/jwt');
const { readFileSync } = require('fs');
const VONAGE_API_KEY = process.env.VONAGE_API_KEY
const VONAGE_API_SECRET = process.env.VONAGE_API_SECRET
const appId = '<application id>';
const privateKey = readFileSync(`${__dirname}/private.key`);
https://www.amazon.com/gp/product/B07QR6Z1JB/ref=ppx_yo_dt_b_asin_title_o06_s00?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B07DHLSTLV/ref=ppx_yo_dt_b_asin_title_o06_s01?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B01LZIDS2A/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B00I3SVVWC/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B01JNLUA5G/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B0006H92QK/ref=ppx_yo_dt_b_asin_title_o07_s01?ie=UTF8&psc=1
/**
* @fileOverview Generate an Id
*/
const _ = require('lodash');
const Hashids = require('hashids');
const hashids = new Hashids(
'',
null,
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-',
);
/**
* @fileOverview Generate an Id
*/
const _ = require('lodash');
const {Hashids} = require('hashids');
const hashids = new Hashids(
'',
null,
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-',
);
const fetchUsersFromCognito = async (
cognitoService,
userPoolId,
limit = 60,
pageToken = null,
) => {
// Not documented in AWS docs but the max limit for this service is 60
if (limit > 60 || limit < 1) {
throw new Error('Invalid range for limit');
}
@manchuck
manchuck / sysctl.conf
Last active August 18, 2016 18:26
Sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
################################
### Kernal / Memory settings ###
################################
# Controls the System Request debugging functionality of the kernel
phpunit
PHPUnit 4.8.27 by Sebastian Bergmann and contributors.
..................................EEEEEE......................EE. 65 / 77 ( 84%)
EE...EEEE..E
Time: 768 ms, Memory: 6.00MB
There were 15 errors:
@manchuck
manchuck / pre-commit
Created May 26, 2016 15:31
Docker pre-commit
#!/bin/sh
# @source: https://gist.github.com/ronanguilloux/11f6a788358577474ab4
# @link http://tech.zumba.com/2014/04/14/control-code-quality/
target_docker_name="api"
bash $PWD/bin/setup-docker.sh $target_docker_name
if [ $? != 0 ]
then
>&2 echo "[pre-commit] no $target_docker_name docker-machine running"
<?php
class Foo {
private $bar = 'chuck';
public function __construct($name = 'max')
{
$this->bar = $name;
}