Skip to content

Instantly share code, notes, and snippets.

View alexcasalboni's full-sized avatar
✌️
Happy coding!

Alex Casalboni alexcasalboni

✌️
Happy coding!
View GitHub Profile
const testInputs = [
// correct
{firstName: '', lastName: '', email: 'first.last@example.com', expectedResult: ''},
{firstName: 'yo', lastName: 'shortname', email: 'david.gilbertson@yahoo.com', expectedResult: ''},
{firstName: 'david', lastName: 'gilbertson', email: 'david.GILBERTSON@gmail.com', expectedResult: ''},
{firstName: 'david', lastName: 'gilbertson', email: 'david.gilbertson@SOME+THING-ODD!!.com', expectedResult: ''},
{firstName: 'david', lastName: 'gilbertson', email: 'DAVId.gilbertson@outlook.com', expectedResult: ''},
{firstName: 'david', lastName: 'gilbertson', email: 'david.gilbertson@yahoo.com', expectedResult: ''},
{firstName: 'david', lastName: 'gilbertson', email: 'david.gilbertson@hotmail.com', expectedResult: ''},
{firstName: 'david', lastName: 'gilbertson', email: 'blah@unknown.com', expectedResult: ''},
@dacamo76
dacamo76 / README.md
Last active September 26, 2017 21:49
Installing scikit-learn on Amazon Linux AMI on EC2

To install scikit-learn easily run the following command.

curl https://gist.githubusercontent.com/dacamo76/4780765/raw/c3779996d8f6b13caaaa48d33aa1585684c7f8e6/scikit-learn-install.sh | sh

Please look over the shell file being run to make sure no evil is done to your machine.

function checkForCloseMatch(longString, shortString) {
// too many false positives with very short strings
if (shortString.length < 3) return '';
// test if the shortString is in the string (so everything is fine)
if (longString.includes(shortString)) return '';
// split the shortString string into two at each postion e.g. g|mail gm|ail gma|il gmai|l
for (let i = 1; i < shortString.length; i++) {
const firstPart = shortString.substring(0, i);
@antonioOrtiz
antonioOrtiz / gulpfile.js
Last active February 4, 2018 18:44
My first gulp file!
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
gulpif = require('gulp-if'),
usemin = require('gulp-usemin'),
uglify = require('gulp-uglify'),
gutil = require('gulp-util'),
concat = require('gulp-concat'),
plumber = require('gulp-plumber'),
browserify = require('gulp-browserify'),
minifyHTML = require('gulp-minify-html'),
@max-mapper
max-mapper / readme.md
Created August 22, 2012 05:08
things I wish github notified me about

the new github notifications (https://github.com/blog/1204-notifications-stars) leaves me wanting more!

  • when someone comments on a gist that I either own or have also commented on
  • when someone comments on a commit (in a project that I'm not part of) that I have commented on
  • when someone makes a commit to a fork of one of my repos

notifications settings should let you choose whether or not to receive emails for the above things. there should also be a web UI that shows you a list of all comments/messages for the above scenarios. at the moment https://github.com/notifications only shows you github issue names which is less useful than showing the actual message (the old notifications page showed actual messages)

@ThisIsMissEm
ThisIsMissEm / handler.js
Created November 25, 2014 18:53
The better way to execute Go on Amazon Lambda (see: http://blog.0x82.com/2014/11/24/aws-lambda-functions-in-go/)
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
}
@alexellis
alexellis / boostrap_faas_arm.md
Last active June 21, 2019 12:55
FaaS serverless framework bootstrap for Raspberry Pi

FaaS serverless framework bootstrap for Raspberry Pi

This bootstraps FaaS onto your Raspberry Pi or ARM board with Docker.

Any Linux/UNIX process can be made a serverless function. Communication with functions is via an API gateway with an easy to use UI portal.

https://github.com/alexellis/faas

Here's the one-shot equivalent from the TestDrive guide

import boto3
import random
def getconfig(key):
return {
'api-delay-services': ['ec2'],
'api-delay-range': [0, 3],
'api-delay-rate': 10,
'aws-fault-services': ['s3', 'dynamodb'],
'api-fault-rate': 10
import pandas as pd
import numpy as np
@GavinJoyce
GavinJoyce / gist:4f81d0bf879dad6b203e
Last active November 20, 2020 04:01
speeding up `npm install` by disabling the progress bar
with `react-native`:
npm set progress=false && rm -rf ~/.npm && rm -rf node_modules && npm cache clean && time npm install
npm install 83.72s user 26.03s system 100% cpu 1:49.32 total
npm set progress=true && rm -rf ~/.npm && rm -rf node_modules && npm cache clean && time npm install
npm install 199.30s user 27.32s system 91% cpu 4:08.29 total
--