Skip to content

Instantly share code, notes, and snippets.

View chadsaun's full-sized avatar

Chad Saunders chadsaun

  • Two Ten Squared
  • Utah
View GitHub Profile
@chadsaun
chadsaun / creditCard.js
Created October 5, 2018 19:34
Vue mixin to get the credit card mask for Vuetify using Cleave.js
const CreditCardDetector = require('cleave.js/src/shortcuts/CreditCardDetector');
export default {
data () {
return {
delimiter: ' - ',
prevCCNumHead: false,
prevMask: false
}
},
@chadsaun
chadsaun / rewrite.py
Created January 30, 2017 16:37
Python Script to Generate Nginx Configuration File From a CSV
yourrewrites_csv = '{}/Desktop/yourrewrites.csv'.format(os.path.expanduser('~'))
csv_file = open(yourrewrites_csv, 'rU')
urls = csv.reader(csv_file)
iterurls = iter(urls)
# Skip the column headers
next(iterurls)
# Create additional columns to assist with sorting
list_to_sort = []
@chadsaun
chadsaun / how_to_customize_terminal_prompt
Created July 16, 2014 21:07
How to customize your terminal prompt
type:
nano .bashrc
Now type:
export PS1=" "
Between the quotation marks, you can add the following lines to customize your Terminal prompt:
stage { "pre": before => Stage["main"] }
class python {
package {
"build-essential": ensure => latest;
"python": ensure => "2.6.6-2ubuntu1";
"python-dev": ensure => "2.6.6-2ubuntu1";
"python-setuptools": ensure => "latest";
}
exec { "easy_install pip":
path => "/usr/local/bin:/usr/bin:/bin",
@chadsaun
chadsaun / Arr.php
Last active December 25, 2015 21:29
A function to rename keys from an array you provide.
<?php defined('SYSPATH') OR die('No direct script access.');
class Arr extends Kohana_Arr {
/**
* Maps new keys to an array
*
* Example:
*
* $customer_values = Arr::remap_keys($_POST, array(
@chadsaun
chadsaun / gist:5455031
Last active December 16, 2015 15:19
Code used to get the CloudWatch alarm datapoints
<?php
$startTime = strtotime('-1 hours');
$endTime = $startTime + 3600;
$startTime = date('c', $startTime);
$endTime = date('c', $endTime);
$result = $client->getMetricStatistics(array(
'MetricName' => 'Latency',