Skip to content

Instantly share code, notes, and snippets.

View kingcody's full-sized avatar

Cody Mize kingcody

  • Digitally Seamless
View GitHub Profile
@kingcody
kingcody / teensyduino.sh
Created December 11, 2018 07:34
Update teensyduino.sh PID Detection
#!/bin/bash
sleep 2
export HOME=$2
$1 & TEENSYPID=$!
sleep 5
xdotool search --class "teensyduino" \
windowfocus \
@kingcody
kingcody / index.js
Created May 18, 2015 04:14
Koa - seperate routers
var app = require('koa')();
app
.use(require('./router1').prefix('/route1').routes())
.use(require('./router2').prefix('/route2').routes());
app.listen(8000);
@kingcody
kingcody / admin.controller.es6
Last active October 27, 2016 14:52
Angular Fullstack - delete confirmation modal example
'use strict';
(function() {
class AdminController {
constructor(User, Modal) {
// Use the User $resource to fetch all users
this.users = User.query();
// Our callback function is called if/when the delete modal is confirmed
@kingcody
kingcody / init
Last active August 29, 2015 14:18
Init for gitlab-ci-multi-runner (docker)
#!/bin/bash
# gitlab-ci-multi-runner data directory
DATA_DIR="/data"
CONFIG_FILE=${CONFIG_FILE:-$DATA_DIR/config.toml}
# custom certificate authority path
CA_CERTIFICATES_PATH=${CA_CERTIFICATES_PATH:-$DATA_DIR/certs/ca.crt}
LOCAL_CA_PATH="/usr/local/share/ca-certificates/ca.crt"
update_ca () {
@kingcody
kingcody / config
Created December 8, 2014 03:06
Irssi config
servers = (
{ address = "eu.irc6.net"; chatnet = "IRCnet"; port = "6667"; },
{ address = "open.ircnet.net"; chatnet = "IRCnet"; port = "6667"; },
{ address = "irc.efnet.org"; chatnet = "EFNet"; port = "6667"; },
{
address = "irc.undernet.org";
chatnet = "Undernet";
port = "6667";
},
{ address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; },
@kingcody
kingcody / test-file-creation.js
Created September 6, 2014 02:06
angular-fullstack testing
/*global describe, beforeEach, it */
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;
var chai = require('chai');
var expect = chai.expect;
var fs = require('fs-extra');
var exec = require('child_process').exec;
describe('angular-fullstack generator', function () {
@kingcody
kingcody / socket.service.js
Last active July 8, 2022 04:06
socket.io service for angular-fullstack
/* global io */
'use strict';
angular.module('testFullstackApp')
.factory('socket', function(socketFactory) {
// socket.io now auto-configures its connection when we ommit a connection url
var ioSocket = io('', {
// Send auth token on connection, you will need to DI the Auth service above
// 'query': 'token=' + Auth.getToken()
// Custom user-defined rules for polkit
//
// See the polkit(8) man page for more information
// about configuring polkit.
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.suspend" ||
action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
action.id == "org.freedesktop.login1.hibernate" ||
action.id == "org.freedesktop.login1.hibernate-multiple-sessions" ||
@kingcody
kingcody / PKGBUILD
Created November 13, 2013 08:24 — forked from detrohutt/PKGBUILD
# Maintainer: Christian Hesse <mail@eworm.de>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
pkgname=udns
pkgver=0.2
pkgrel=1
pkgdesc='Stub DNS resolver library with ability to perform both syncronous and asyncronous DNS queries'
url='http://www.corpit.ru/mjt/udns.html'
license=('LGPL')
arch=('i686' 'x86_64' 'armv6h')
@kingcody
kingcody / toCamelCase
Last active December 25, 2015 22:39
extend js string object to include toCamelCase method
// string.toCamelCase()
if (!String.prototype.toCamelCase) {
String.prototype.toCamelCase = function toCamelCase() {
return this.toLowerCase().replace(/(\-[a-zA-Z])/g, function($1) {
return $1.toUpperCase().replace('-','');
})
};
}