Skip to content

Instantly share code, notes, and snippets.

View rud's full-sized avatar

Laust Rud Jacobsen rud

View GitHub Profile
@jeffkreeftmeijer
jeffkreeftmeijer / application.rb
Created February 14, 2011 13:08
Lighthouse Keeper: turns Lighthouse API XML into RSS - http://keeper.jeffkreeftmeijer.com
class Application < Sinatra::Base
get '/:domain/:project' do
tickets = HTTParty.get(
"https://#{params[:domain]}.lighthouseapp.com/projects/#{params[:project]}/tickets.xml?q=#{params[:q]}"
)['tickets']
builder do |xml|
xml.instruct! :xml, :version => '1.0'
xml.rss :version => "2.0" do
xml.channel do
@stan
stan / 0_instructions.txt
Created May 19, 2011 02:25 — forked from sgruhier/0_instructions.txt
Sprocket 2 in Rails 3.0.x ala Rails 3.1
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
filesystem will be different but this guide will get you working with it
while we wait for all that to finalize.
Ignore the number prefixes on each file. This is just to ensure proper order in the Gist.
It's based on eric1234 gist https://gist.github.com/911003. ijust made it 3.1 compliant in terms of convention
require "digest/md5"
require "resque-retry"
require "resque-loner"
#
# Statused Worker Example:
#
# class MyStatusedWorker < StatusedWorker
# def self.job_identity_arguments(user_id, credit_card_number, attributes = {})
# [user_id]
@dipth
dipth / network.yml
Created October 19, 2011 19:20
Tunneling to your local development computer
development:
tunnel:
public_host_username: root
public_host: [IP OF YOUR PUBLIC SERVER]
public_port: 3000
local_port: 3000
ssh_port: 22
server_alive_interval: 0
@nathanl
nathanl / activerecord_scope_conditions.rb
Created June 11, 2013 14:45
Using joins and conditions in ActiveRecord scopes. (This was hard for me to find documentation on.)
class Person < ActiveRecord::Base
# This manual SQL query...
scope :allowed_to_eat_cheese, joins(
<<-SQL
INNER JOIN cities ON people.city_id = cities.id
INNER JOIN states ON cities.state_id = states.id
SQL
).where('states.allows_cheese_consumption' = 'Yeppers')
@obfusk
obfusk / break.py
Last active May 1, 2024 20:32
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@thomasdarimont
thomasdarimont / App.java
Created November 6, 2018 19:09
Simple Spring Boot App protected by Keycloak with initial roles from Keycloak and additional hierarchical app Internal roles. Supports fine grained permission checks, where the permissions are derived from roles.
package demo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
Capybara.register_driver :https_chrome do |app|
browser_options = Selenium::WebDriver::Chrome::Options.new
browser_options.add_argument('allow-insecure-localhost') # Ignore TLS/SSL errors on localhost
browser_options.add_argument('ignore-certificate-errors') # Ignore certificate related errors
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end