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
seed_file = Rails.root.join('db', 'seeds', "#{Rails.env}.rb") | |
load seed_file if File.file?(seed_file) |
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
stub_request(:get, %r{#{ENV['XYZ_SERVICE_SERVER']}/api/v2/get_entities*}) | |
.to_return(build(:xyz_service_get_entities_response)) | |
allow(XyzService).to receive(:get_entities).and_return(build(:xyz_service_get_entities_response)) |
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
FactoryBot.define do | |
factory :xyz_service_get_entities_response, class: Hash do | |
skip_create | |
initialize_with { { body: attributes[:body].to_json }.stringify_keys } | |
body do | |
{ | |
data: [ | |
{ key: SecureRandom.hex, name: Faker::Lorem.word }, | |
{ key: SecureRandom.hex, name: Faker::Lorem.word } |
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 'file-tail' | |
require 'rb-notifu' | |
File.open("C:/Program Files (x86)/Grinding Gear Games/Path of Exile/logs/Client.txt") do |log| | |
log.extend(File::Tail) | |
log.backward(1).tail do |line| | |
Notifu::show :message => "NEXT ROOM", :type => :warn, :time => 5 do; end if line=~/The room grows still and quiet/ | |
Notifu::show :message => "DONE", :type => :warn, :time => 5 do; end if line=~/The oppressive atmosphere slowly dissipates/ | |
Notifu::show :message => "SOMEONE LEFT", :type => :warn, :time => 5 do; end if line=~/has left the area/ |
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
// config/snapshotResolver.js | |
module.exports = { | |
resolveSnapshotPath: (testPath, snapshotExtension) => testPath + snapshotExtension, | |
resolveTestPath: (snapshotFilePath, snapshotExtension) => snapshotFilePath.slice(0, -snapshotExtension.length), | |
}; | |
// package.json | |
"jest": { | |
"snapshotResolver": "<rootDir>/config/snapshotResolver.js" | |
} |
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
cd FOLDER | |
."C:\Program Files\VideoLan\VLC\vlc.exe" input1.mp4 input2.mp4 vlc://quit --sout "#gather:std{access=file,dst=output.avi}" --sout-keep |
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
package com.thisismydesign; | |
import org.apache.commons.codec.binary.Hex; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public final class EscapeUtil { | |
private final static Pattern pipe = Pattern.compile("\\|"); |
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
module CreateClassMethodsUponInclude | |
def self.included(base) | |
base.define_singleton_method :included do |base| | |
base.extend(self) | |
end | |
end | |
end | |
module MyModule | |
include CreateClassMethodsUponInclude |
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
module CreateClassMethodsUponInclude | |
def self.included(base) | |
# does what we want | |
end | |
end | |
module MyModule | |
include CreateClassMethodsUponInclude | |
# ... |
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 self.included(base) | |
base.extend(self) | |
end |