Skip to content

Instantly share code, notes, and snippets.

View skinofstars's full-sized avatar

Kevin Carmody skinofstars

View GitHub Profile
@skinofstars
skinofstars / feature_macros.rb
Created April 9, 2014 17:36
RSpec + Capybara + Devise + Factory Girl: login macro
# support/feature_macros.rb
module FeaturesMacros
def signin_admin
DatabaseCleaner.clean
@user ||= FactoryGirl.create(:user)
visit '/sign_in'
within("#new_user") do
fill_in 'user[email]', :with => user.email
@skinofstars
skinofstars / gist:4207221
Created December 4, 2012 18:29
Whitespace python for loop - for when you don't want to use split( )
entry = input("Enter a Mayan date: ")
i=0 # this is used to track our position in the string
output = "" # start with output set to nothing
while entry[i:]:
# if we hit a space, then we've got to the end of that number
# print it out and reset the output
if entry[i] == " ":
print (output)
@skinofstars
skinofstars / getUSPSKeylineCheckDigit.spec.ts
Created June 14, 2021 18:40
USPS Traditional ACS keyline MOD 10 check digit
const keylinesChecks: [string, number][] = [
['JLSTMS6796', 9],
['TMS1112/62', 3],
['218XN91LMS', 4],
['OTUBIKALAM', 8],
['ABC999NN//3', 2],
['ANIT 028', 1],
['0012 ////', 8],
['811N IS00 0111', 9],
['OTUB IKAL AM', 8],
@skinofstars
skinofstars / crypt.js
Last active October 6, 2020 22:06
Public-key Cryptography in NodeJS
// FROM https://vanjs-decentralized.hashbase.io/#12
const crypto = require('crypto');
const read = require('fs').readFileSync;
// The original message
const message = Buffer.from('Hi Alice! This is a secret :)');
// ENCRYPT message with Alice PUBLIC key
const alicePublicKey = read('./keys/alice/public_key.pem');
@skinofstars
skinofstars / .gitignore
Created August 19, 2020 08:37
XCode Swift gitignore
# Node builds
.cache/
coverage/
node_modules/
*.log
# Exclude build output
macos.safari-extension/yeehah_extension/script.js
@skinofstars
skinofstars / wp_believe.md
Last active August 11, 2020 10:12
wp_believe

I believe the president Made America Great Again. I believe we need him reelected to Make America Great Again Again.

I believe Joe Biden is “Sleepy” and “weak.” I believe Biden could “hurt God” and the Bible.

I believe that if Biden is elected, there will be “no religion, no anything,” and he would confiscate all guns, “immediately and without notice.” He would “abolish” “our great,” “beautiful suburbs,” not to mention “the American way of life.” There would be “no windows, no nothing” in buildings.

I believe the news media would have “no ratings” and “will go down along with our great USA!” if the president loses — and that this would be bad even though the media is fake.

I believe it’s normal for the president to say “Yo Semites” and “Yo Seminites,” “Thigh Land,” “Minne-a-napolis,” “toe-tally-taria-tism,” “Thomas Jeffers” and “Ulyss-eus S. Grant.” I believe it’s Biden who’s cognitively impaired.

@skinofstars
skinofstars / hosts
Last active June 2, 2020 08:16
Ansible static site deploy
[live]
live ansible_ssh_host=12.34.56.78 ansible_ssh_user=ubuntu
@skinofstars
skinofstars / packer.json
Created March 18, 2015 11:50
Ansible packer.json example
{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "eu-west-1",
@skinofstars
skinofstars / services.js
Created June 13, 2019 10:03
FeathersJS - Demo of services picking up each others hooks
module.exports = function(app) {
class BeepBoop {
async update(id, data, params) {
console.log("BeepBoop", id, params);
// passing params here will also pass the route.id
await app.service("zap").update("456", {}, params);
return Promise.resolve();
}
@skinofstars
skinofstars / model-includes.hook.js
Last active August 10, 2017 02:57
Feathers hook for including seqeulize models
'use strict';
// Feathers hook to do `/thing?includes=other`
// before : {
// find: [modelIncludes()],
// get: [modelIncludes()]
// },
// after : {
// find: [modelIncludes()],