Skip to content

Instantly share code, notes, and snippets.

View tdegrunt's full-sized avatar

Tom de Grunt tdegrunt

View GitHub Profile
@tdegrunt
tdegrunt / sidekiq_monitoring
Created February 15, 2020 23:10 — forked from ngsmrk/sidekiq_monitoring
Sidekiq queue checking via rails console
stats = Sidekiq::Stats.new
stats.queues
stats.enqueued
stats.processed
stats.failed
@tdegrunt
tdegrunt / bt-agent.service
Created June 28, 2019 05:56 — forked from rcarmo/bt-agent.service
Set up PAN networking on Raspbian Stretch (use sudo to create these files and run all commands)
# in /etc/systemd/system
[Unit]
Description=Bluetooth Agent
[Service]
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
Type=simple
[Install]
WantedBy=multi-user.target
@tdegrunt
tdegrunt / Gemfile
Created February 14, 2019 21:23 — forked from Dmdv/Gemfile
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"

;; Automatically generated
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(anzu-cons-mode-line-p nil)
@tdegrunt
tdegrunt / .gitignore
Created May 22, 2018 07:13
Ruby programming with VS Code
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
@tdegrunt
tdegrunt / readme.md
Created April 5, 2018 09:37 — forked from maxivak/readme.md
Integrating Gem/Engine and Main Rails App
@tdegrunt
tdegrunt / async_console.rb
Created February 5, 2018 14:35 — forked from postmodern/async_console.rb
An asynchronous Console that can evaluate Ruby code in the background.
require 'thread'
class AsyncConsole
#
# Creates a new Asynchronous Console, within the given context.
#
# @param [Module] context
# The context to evaluate code within.
#
@tdegrunt
tdegrunt / better_image_tag.rb
Created October 30, 2017 11:28 — forked from pichfl/better_image_tag.rb
Liquid Image Tag for Jekyll
# A simple plugin for Jekyll that allows you to use {% url "alt text" %} to add images to your posts.
# It will automatically check those images for width and height.
#
# Requires http://imagesize.rubyforge.org/
require 'image_size'
require 'open-uri'
module Jekyll
@tdegrunt
tdegrunt / env.rb
Created April 20, 2017 17:38
Browserstack remote capabilities and tunnel setup (capybara with cucumber)
Capybara.app_host = "http://localhost:3001"
Capybara.run_server = false
@tdegrunt
tdegrunt / agent.rb
Created February 25, 2017 23:03 — forked from genericsteele/agent.rb
Custom Assertions
class Agent < ActiveRecord::Base
validates :first_name, :last_name, :email, presence: true
validates :email, uniqueness: true
has_many :missions
scope :on_assignment, -> { Agent.joins(:missions).where(missions: { status: 'active' }) }
scope :not_on_assignment, -> { where.not(id: Agent.on_assignment.pluck(:id)) }
def name
"#{first_name} #{last_name}"
end