Skip to content

Instantly share code, notes, and snippets.

View benkitzelman's full-sized avatar
🏠
Working from home

Ben Kitzelman benkitzelman

🏠
Working from home
  • Locomote
  • Melbourne, Australia
View GitHub Profile
@benkitzelman
benkitzelman / GH Action - every monday at 2pm
Last active March 23, 2023 07:18
Check the SSL cert expiry times are within x days and notify via slack
name: Check the state of SSL on production
on:
schedule:
- cron: '0 14 * * 1'
jobs:
issue:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check SSL Cert and post outcome on slack channel

Keybase proof

I hereby claim:

  • I am benkitzelman on github.
  • I am beano (https://keybase.io/beano) on keybase.
  • I have a public key whose fingerprint is 1C8B A9D4 5107 DCF3 3528 EEBB 2005 739B 318E AB7E

To claim this, I am signing this object:

@benkitzelman
benkitzelman / telstra-monitor.plist
Last active August 15, 2018 12:43
Telstra honesty report - monitor connection drops
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>telstra-monitor</string>
<key>KeepAlive</key>
<true/>
### Keybase proof
I hereby claim:
* I am benkitzelman on github.
* I am beano (https://keybase.io/beano) on keybase.
* I have a public key whose fingerprint is 45F5 25B7 A611 A624 46DA B9DE 5D07 6750 B081 1001
To claim this, I am signing this object:
@benkitzelman
benkitzelman / SineWave.cs
Created April 25, 2013 10:30
Generate WAV formatted dtmf tones in C#
using System;
using System.Collections.Generic;
using System.Text;
namespace ConversionLayer.Wave
{
internal class SineWave
{
#region Fields
@benkitzelman
benkitzelman / safeRead.js
Last active December 16, 2015 03:49
A safe format function to read deeply nested properties (i.e. my.nested.value)... If any property in the chain is null or undefined, an empty string will be returned
//
// Usage... for a nested structure
// var test = {
// nested: {
// value: 'Read Correctly'
// }
// };
// safeRead(test, 'nested', 'value'); // returns 'Read Correctly'
// safeRead(test, 'missing', 'value'); // returns ''
//
@benkitzelman
benkitzelman / isPopupBlocked.js
Last active December 16, 2015 03:48
Detect if a popup is blocked in major browsers
var isPopupBlocked = function() {
var isBlocked,
popup = window.open('about:blank', 'popup_test','width=5, height=5, left=0, top=0');
// pop under
if(popup) popup.blur();
window.focus();
isBlocked = !popup || typeof popup == 'undefined' || typeof popup.closed=='undefined' || popup.closed || popup.innerHeight == 0;
if(popup) popup.close();
@benkitzelman
benkitzelman / config.ru
Last active August 15, 2018 12:43
Using and configuring the Google Ajax Crawler to facilitate search engine indexing of ajax rich pages (client MVC and the Google Ajax Crawling Scheme)
#
# to run:
# $ rackup config.ru -p 3000
# open browser to http://localhost:3000/#!test
#
require 'bundler/setup'
require './lib/google_ajax_crawler'
use GoogleAjaxCrawler::Crawler do |config|
config.driver = GoogleAjaxCrawler::Drivers::CapybaraWebkit
@benkitzelman
benkitzelman / gist:5309877
Created April 4, 2013 12:14
Using Sinatra Asset Snack
require 'sinatra/asset_snack'
class App < Sinatra::Base
register Sinatra::AssetSnack
asset_map '/javascript/application.js', ['assets/js/**/*.js', 'assets/js/**/*.coffee']
asset_map '/stylesheets/application.css', ['assets/stylesheets/**/*.css', 'assets/stylesheets/**/*.scss']
get '/' do
erb :index
end
@benkitzelman
benkitzelman / country_codes.rb
Created February 24, 2013 12:36
ISO_3166-1 country codes 2 char to 3 char mapping
module CountryCodes
class << self
def two_char_code_for(three_char_country_code)
if country = CODES[three_char_country_code.to_sym]
country[:two_char_code]
end
end
def three_char_code_for(two_char_country_code)
CODES.select {|k,v| v[:two_char_code].to_sym == two_char_country_code.upcase.to_sym}.keys.first