This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const applicationMachine = Machine({ | |
id: 'application', | |
initial: 'Unlocked', | |
states: { | |
Unlocked: { | |
on: { Confirmed: 'Decision'}, | |
}, | |
Decision: { | |
on: { | |
No: 'Rejected', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello | |
world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def set-schema-registry-haproxy-events-to-critical | |
(where (and (service schema-registry-500-error-service-name) | |
(not= metric nil) | |
(>= metric schema-registry-500-error-threshold) | |
(state "ok")) | |
(with :state "critical" reinject))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# reload haproxy, but avoid losing existing connections | |
# | |
# briefly reject connection (SYN) TCP packets during port switch, so that | |
# connections are retried | |
# | |
# see: | |
# https://medium.com/@Drew_Stokes/actual-zero-downtime-with-haproxy-18318578fde6 | |
# http://engineeringblog.yelp.com/2015/04/true-zero-downtime-haproxy-reloads.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'RMagick' | |
include Magick | |
width = 90 | |
height = 100 | |
matrix = [ | |
[0,1,0,0,0], | |
[0,1,0,0,0], | |
[0,0,1,0,0], | |
[0,1,0,0,0], | |
[0,1,0,0,0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# ______ _ _ | |
# | ___ \ (_) | | |
# | |_/ /_ __ ___ _ __ _| | ___ _ __ | |
# | ___ \ '__/ _ \| '_ \| | |/ _ \ '__| | |
# | |_/ / | | (_) | |_) | | | __/ | | |
# \____/|_| \___/| .__/|_|_|\___|_| | |
# | | | |
# |_| | |
require 'net/scp' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee < ActiveRecord::Base | |
has_many :timeslots | |
scope :free_time, lambda {|day| joins(:timeslots).merge(Timeslot.on(day)) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
promptList (x:[]) partial = do | |
putStrLn ("Enter value for " ++ x) | |
input<-getLine | |
(partial ++ [input]) | |
promptList (x:xs) partial = do | |
putStrLn ("Enter value for " ++ x) | |
input<-getLine | |
promptList xs (partial ++ [input]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Message{ | |
public String recipient, sender,body; | |
public Message(String recipient, String sender,String body){ | |
this.recipient=recipient; | |
this.sender=sender; | |
this.body = body; | |
} | |
public void append(String text){ | |
this.body = this.body + text; |
NewerOlder