Skip to content

Instantly share code, notes, and snippets.

View aclave1's full-sized avatar

Alex Clavelle aclave1

  • Meta
  • Bay Area, California
View GitHub Profile
@aclave1
aclave1 / recursion.js
Created March 6, 2020 05:28
recursion example for a friend
// example 1
x();
function x() {
console.log('hello!')
x();
}
//example 2
print_multiple_times(10)
@aclave1
aclave1 / UmbracoCMS_Csproj_Regex
Created September 21, 2018 18:21
Umbraco CMS csproj wildcard regex
# Basic wildcards
```
<Content Include="App_Plugins\**" />
<Content Include="config\**" />
<Content Include="Content\**" />
<Content Include="css\**" />
<Content Include="js\**" />
<Content Include="Views\**" />
<Content Include="fonts\**" />
@aclave1
aclave1 / emailscanner.js
Created August 25, 2016 16:00
Scans for emails in html page
document.body.outerHTML.match(/[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?/g)
@aclave1
aclave1 / gist:a68fdf84e27c031231f2
Created September 1, 2015 14:58
count the number of times an element occurs in an array
[1,2,3,1,1,2,3,4].reduce(function(map,val){
map[val] = typeof map[val] !== 'undefined' ? map[val]+1 : 1;
return map;
},{});
@aclave1
aclave1 / vendorprefix.less
Created April 27, 2015 18:56
less vendor prefix
.vendorprefix(@property, @value) {
-webkit-@{property}: @value;
-khtml-@{property}: @value;
-moz-@{property}: @value;
@{property}: @value;
}
@aclave1
aclave1 / webpack.config.js
Last active August 29, 2015 14:19
A reference webpack config.
var webpack = require('webpack');
var path = require('path');
module.exports = {
context: __dirname + '/assets/js',
//the file to build
entry: './main.js',
output: {
### Keybase proof
I hereby claim:
* I am aclave1 on github.
* I am aclavelle (https://keybase.io/aclavelle) on keybase.
* I have a public key whose fingerprint is 6E4E E5F2 CEFD 2D0D 6AE2 2A1D CF58 806E 4F50 9E99
To claim this, I am signing this object:
@aclave1
aclave1 / directivebuilder.js
Last active August 29, 2015 14:17
A provider for a "directive builder". Inject this provider into a directive declaration and return its invocation and it will build a directive definition object. I got this idea from angular-ui-bootstrap's code here: https://github.com/angular-ui/bootstrap/blob/master/src/tooltip/tooltip.js#L12
module.exports = function () {
this.$get = [function () {
return function directiveBuilder(config) {
var options = config || {};
return {
replace: true,
restrict: "E",
# Load balancer configuration
upstream exampleApp {
# Directs to the process with least number of connections.
least_conn;
# One failed response will take a server out of circulation for 20 seconds.
server 127.0.0.1:10080 fail_timeout=20s;
#server 127.0.0.1:10081 fail_timeout=20s;
#server 127.0.0.1:10082 fail_timeout=20s;
#server 127.0.0.1:10083 fail_timeout=20s;
@aclave1
aclave1 / envocapplication.js
Last active August 29, 2015 14:09
job application for Envoc
var http = require('http');
var body = JSON.stringify({
Name:"OMITTED",
PhoneNumber: "OMITTED",
Email:"OMITTED",
Position:"Javascript Developer",
Urls:[