Skip to content

Instantly share code, notes, and snippets.

View alsemyonov's full-sized avatar
🏠
Working from home

Alex Semyonov alsemyonov

🏠
Working from home
View GitHub Profile
@v-kolesnikov
v-kolesnikov / spec_helper.rb
Created December 13, 2018 12:42
Using a container to manage tests components
# frozen_string_literal: true
require_relative '../system/my_app/container'
module MyApp
module Tests
class Container < Dry::System::Container
use :env, inferrer: -> { 'test' }
configure do
@mottalrd
mottalrd / event_sourcing_intro.rb
Last active November 2, 2023 21:47
An introduction to event sourcing, London Ruby User Group, 9th May 2018
module Commands
module Meeting
AcceptSchema = Dry::Validation.Schema do
required(:user_id).filled
required(:status).value(eql?: :scheduled)
end
class Accept < Command
def call
return validate if validate.failure?
@andyyou
andyyou / rails_webpacker_bootstrap_expose_jquery.md
Last active August 9, 2022 07:38
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collects all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
@venik
venik / build_tf.sh
Last active February 22, 2024 06:12
Bash script for local building TensorFlow on Mac/Linux with all CPU optimizations (default pip package has only SSE)
#!/usr/bin/env bash
# Author: Sasha Nikiforov
# source of inspiration
# https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions
# Detect platform
if [ "$(uname)" == "Darwin" ]; then
# MacOS
class Service
class TransactionWrapper
TransactionFailed = Class.new(StandardError)
attr_reader :sequence
delegate :append, :prepend, to: :sequence
def initialize(sequence, connection)
@sequence = sequence
@connection = connection
@kristianmandrup
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active April 21, 2023 17:14
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

@jdarling
jdarling / data.json
Last active November 6, 2023 16:03
D3 MindMap
{
"name": "Root",
"children": [
{
"name": "Branch 1",
"children": [
{"name": "Leaf 3"},
{"name": "Leaf 4"}
]
},
@Aeon
Aeon / adapters-application.js
Last active March 21, 2016 18:50
faye adapter for ember-data
require('config/adapters/faye-adapter');
export default DS.FayeAdapter.extend();
@tonycoco
tonycoco / select2.rb
Created February 19, 2014 17:28
Select2 Capybara Support File
# Useage: select2("value to select", from: "label text")
module Capybara
module Select2
def select2(value, options={})
select_name = options[:from]
select2_container = first("label", text: select_name).find(:xpath, "..").find(".select2-container")
select2_container.find(".select2-choice").click
find(:xpath, "//body").find(".select2-drop li", text: value).click
end
@tonycoco
tonycoco / controller_spec.rb
Last active May 25, 2023 06:04
The Greatest Hits of Rspec Testing: Volume 1
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end