Skip to content

Instantly share code, notes, and snippets.

View christian-schulze's full-sized avatar

Christian Schulze christian-schulze

View GitHub Profile
@christian-schulze
christian-schulze / gist:1676468
Created January 25, 2012 14:20
DCI example where a single user has two roles
# DCI example where a single user has two roles
class AuthorizeEmployeeDiscount
attr_accessor :employee, :manager
def self.execute(employee_user_id, manager_user_id)
AuthorizeEmployeeDiscount.new(employee_user_id, manager_user_id).execute
end
def initialize(employee_user_id, manager_user_id)
@employee = User.find(employee_user_id)
@christian-schulze
christian-schulze / gist:44e0dde4e9e8d824f546
Last active February 7, 2016 07:46 — forked from spiegela/gist:4712000
JRuby & Akka Example
#!/usr/bin/env ruby
require 'java'
require 'scala-library.jar'
require 'config-1.0.0.jar'
require 'akka-actor_2.10-2.1.0.jar'
java_import 'java.io.Serializable'
java_import 'akka.actor.UntypedActor'
java_import 'akka.actor.ActorRef'
require 'rubygems'
require 'spoon'
Spoon.spawnp 'jruby', *ARGV

Keybase proof

I hereby claim:

  • I am christian-schulze on github.
  • I am christians (https://keybase.io/christians) on keybase.
  • I have a public key ASDS4X1v__QgFXvi8MhTMfT4mmF2B0Ay2Jg05RUyYFbQ2Qo

To claim this, I am signing this object:

@christian-schulze
christian-schulze / _decimal.scss
Created February 11, 2017 10:16 — forked from terkel/_decimal.scss
Rounding decimals in Sass
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
// Round a number to specified digits.
//
// @param {Number} $number A number to round
// @param {Number} [$digits:0] Digits to output
// @param {String} [$mode:round] (round|ceil|floor) How to round a number
// @return {Number} A rounded number
// @example
// decimal-round(0.333) => 0
const exception = {
data: {
error: {
type: "Runtime Error",
description: "asdf asdf asdf asdf",
handled: true
},
extension: {
response: {
statusCode: 500,
@christian-schulze
christian-schulze / .babelrc
Created August 13, 2019 11:09
babel boilerplate
{
"presets": ["@babel/preset-env"]
}
@christian-schulze
christian-schulze / Hyper.md
Last active August 21, 2021 08:22 — forked from toroidal-code/Hyper.md
Mapping the Hyper key to RALT, RWIN or RCTRL

Mapping the Hyper key to RALT, RWIN or RCTRL

Gnome, Cinnamon, and KDE all use xkb to manage keyboard mappings.

For Gnome, you use gnome-tweak-tool to access all of the xkb options.

I'm working on Ubuntu 21.04 using Gnome 38.8.5, so all of my xkb files are under /usr/share/X11/xkb. Consult your distro's documentation if this is not the case for you.

The first file we're going to be working with is an addition, under symbols in that xkb folder. It should already have a bunch of files like us and dvp etc. We're going to be adding a new file called hyper. So on my computer, this is /usr/share/X11/xkb/symbols/hyper.

@christian-schulze
christian-schulze / setupFilesAfterEnv.js
Created August 24, 2021 09:57 — forked from bvaughn/setupFilesAfterEnv.js
Jest config to remove extra console location / formatting noise
import { CustomConsole } from '@jest/console';
function formatter(type, message) {
switch(type) {
case 'error':
return "\x1b[31m" + message + "\x1b[0m";
case 'warn':
return "\x1b[33m" + message + "\x1b[0m";
case 'log':
default:
@christian-schulze
christian-schulze / deployment.yml
Created May 12, 2022 23:00
manual (no helm) nfs-subdir-external-provisioner example using two provisioners
apiVersion: apps/v1
kind: Deployment
metadata:
name: nfs-client-provisioner
labels:
app: nfs-client-provisioner
namespace: default
spec:
replicas: 1
strategy: