Skip to content

Instantly share code, notes, and snippets.

Avatar
🌞

Dan Farrelly djfarrelly

🌞
View GitHub Profile
@djfarrelly
djfarrelly / local-deploy.sh
Last active Jul 12, 2019
How to test your helm chart values yaml files locally
View local-deploy.sh
#!/bin/bash
# Usage `./local-deploy.sh <command> <service-name>
# Requirements: helm must be installed and match the version on our cluster
# commands:
# deploy Deploys the code to the cluster (requires cluster access)
# dry-run Prints the k8s deployment and service yaml files generates by helm
CMD="$1"
SVC="$2"
@djfarrelly
djfarrelly / folders.sh
Last active Apr 5, 2019
maildev folder structure
View folders.sh
# 3 package approach
/maildev-smtp
/src # most of what currently is in /lib
/test
/index.js
/package.json
/maildev-ui
/src # all the react components, etc.
/public
/package.json
@djfarrelly
djfarrelly / 1-regular-probes.yaml
Last active Aug 31, 2018
Reply Server liveness and readiness probes
View 1-regular-probes.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: respond-server
namespace: reply
spec:
replicas: 12
strategy:
rollingUpdate:
maxSurge: 2
@djfarrelly
djfarrelly / MongoIdShim.php
Created Apr 5, 2018
mongo to mongodb php driver migration helpers
View MongoIdShim.php
<?php
class MongoId implements Serializable, JsonSerializable
{
public $id;
public function __construct($id)
{
$this->id = (string) $id;
}
@djfarrelly
djfarrelly / index.js
Last active Apr 22, 2017
requirebin sketch
View index.js
const logger = (t) => (document.body.innerHTML = `${document.body.innerHTML}<br>${JSON.stringify(t)}`)
/// app
const { createStore, combineReducers } = require('redux')
const OPEN_COMPOSER = 'OPEN_COMPOSER'
const CLOSE_COMPOSER = 'CLOSE_COMPOSER'
// The metrics reducer - we just grab the even and let the state pass through
const bufferMetrics = (state = {}, action) => {
@djfarrelly
djfarrelly / .hyperterm.js
Last active Sep 19, 2016
Personal HyperTerm perfs
View .hyperterm.js
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 16,
// font family with optional fallbacks
fontFamily: '"Droid Sans Mono For Powerline", "Roboto Mono", Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color (hex)
// cursorColor: '#F81CE5',
View Dockerfile
FROM alpine:3.3
ADD logger.sh /logger.sh
RUN chmod +x /logger.sh
CMD /bin/sh -c "/logger.sh"
@djfarrelly
djfarrelly / next.js
Created Oct 22, 2015
ES2015 intro chat
View next.js
'use strict';
// What is ES2015?
// !!!!!!!!!!!!!! let, const !!!!!!!!!!!!!!!!!!!!!!
const ONE_HOUR = 60 * 60 * 1000;
ONE_HOUR = 60 * 60;
// Throws error
View Button.jsx
import classNames from 'classnames';
import getValidProps from '../lib/utils';
class Button extends React.Component {
render () {
var classes = classNames('Button', {
'Button--large': this.props.size === 'large',
'Button--small': this.props.size === 'small',
'Button--primary':this.props.primary,
'Button--hollow': this.props.hollow
@djfarrelly
djfarrelly / analyticsStore.js
Last active Aug 29, 2015
In an effort to more intelligently request data for sent updates
View analyticsStore.js
var AnalyticsStore = modules.exports = {
_data: new Backbone.Collection(),
_daysInCache: [],
grabDaysForCache: function(data) {
var days = data.updates.map(function(update){
return Math.r(update.due_at / 24 / 3600); // days since 1970
});