Skip to content

Instantly share code, notes, and snippets.

@ConnerAiken
ConnerAiken / script.php
Created October 11, 2019 18:18
PHP 7 Benchmark test, regex for empty string validation vs php functions
<?php
// This script compares regex validation vs php validation speeds for a sample JSON data set
// =================================
// Fetch some sample data
// =-=-=-=-=-=-=-=-=-=-=-=-
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@ConnerAiken
ConnerAiken / phpInstall.sh
Created December 21, 2018 17:24
Install multiple versions of PHP in parallel for Ubuntu
#!/bin/bash
# Install common dependency
sudo apt install python-software-properties
# Add Ondřej Surý PPA
sudo add-apt-repository ppa:ondrej/php
# Update apt
@ConnerAiken
ConnerAiken / README.md
Last active April 26, 2018 20:13
ES5 "Classes": Methods in Function() vs Prototype
@ConnerAiken
ConnerAiken / README.md
Created April 14, 2018 20:03 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@ConnerAiken
ConnerAiken / README.md
Created March 31, 2018 05:16
js/jsx loader for webpack4 - babel-loader
@ConnerAiken
ConnerAiken / robbyrussell.zsh-theme
Created March 20, 2018 16:34
ZShell - Robby Russell Theme /w User@Host in prompt
GNU nano 2.5.3 File: /home/connera/.oh-my-zsh/themes/robbyrussell.zsh-theme Modified
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
# Customize and add user/host perfix
PROMPT="%{$fg[white]%}%n@%{$fg[green]%}%m%{$reset_color%} ${PROMPT}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
@ConnerAiken
ConnerAiken / script.sh
Created March 16, 2018 18:52
Sync two git repositories
#!/bin/bash
# REPO_NAME=<repo>.git
# ORIGIN_URL=git@<host>:<project>/$REPO_NAME
# REPO1_URL=git@<host>:<project>/$REPO_NAME
rm -rf $REPO_NAME
git clone --bare $ORIGIN_URL
cd $REPO_NAME
git remote add --mirror=fetch repo1 $REPO1_URL
@ConnerAiken
ConnerAiken / commands.txt
Created February 23, 2018 17:43
Jenkins - Clear build history
// change this variable to match the name of the job whose builds you want to delete
def jobName = "Your Job Name"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
// uncomment these lines to reset the build number to 1:
//job.nextBuildNumber = 1
//job.save()
@ConnerAiken
ConnerAiken / index.html
Created November 22, 2017 17:11
Async/Await example
<!DOCTYPE html>
<html>
<head>
<script>
const validUrl = 'https://jsonplaceholder.typicode.com/posts';
const invalidUrl = 'https://jsonplaceholder.invalid.domain.com/posts';
function downloadData(url) {
console.log(`[downloadData()] attempting AJAX request to ${url}`);
@ConnerAiken
ConnerAiken / .robomongorc.js
Created August 11, 2017 16:59
Robomongo - add CSV Export option
// Export to CSV function
DBQuery.prototype.toCSV = function(deliminator, textQualifier)
{
var count = -1;
var headers = [];
var data = {};
var cursor = this;
deliminator = deliminator == null ? ',' : deliminator;