Skip to content

Instantly share code, notes, and snippets.

View plus3x's full-sized avatar

Vladislav Petrov plus3x

View GitHub Profile
let g:rails_projections = {
\ "config/projections.json": {
\ "command": "projections"
\ },
\ "app/services/*.rb": {
\ "command": "service",
\ "affinity": "model",
\ "test": "spec/services/%s_spec.rb",
\ "related": "app/models/%s.rb",
\ "template": "class %S\n\n def run\n end\nend"
##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
@plus3x
plus3x / bootstrap-sass-base.scss
Created March 16, 2017 14:40
Bootstrap SASS Base
$bootstrap-sass-asset-helper: false !default;
//
// Variables
// --------------------------------------------------
//== Colors
//
//## Gray and brand colors for use across Bootstrap.
@plus3x
plus3x / add_setting.rb
Last active July 2, 2017 16:14
Use extend module Settings or reuse one method from settings model
require 'active_record'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
ActiveRecord::Schema.define do
self.verbose = false
create_table :settings do |t|
t.string :name
t.integer :value
@plus3x
plus3x / scopes.txt
Created December 18, 2017 08:26 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@plus3x
plus3x / http_performance.rb
Created December 3, 2020 12:10
Ruby HTTP gem performance
require 'benchmark'
uri = URI('http://stackoverflow.com/questions/30899019/')
n = 10
require 'net/http'
puts
puts "Net::HTTP:"
Benchmark.bm do |b|
@plus3x
plus3x / .aliases
Last active September 29, 2022 07:15
My aliases
#!/bin/bash
alias ln="ln -v"
alias mkdir="mkdir -p"
alias ...="../.."
alias l="ls"
alias ll="ls -al"
alias lh="ls -Alh"
# alias -g G="| grep"
# alias -g M="| less"
@plus3x
plus3x / include_json_matcher.rb
Last active April 23, 2025 07:24
RSpec - Include Json matcher
# frozen_string_literal: true
RSpec::Matchers.define :include_json do |expected|
match do |response|
values_match? expectation, actual
end
diffable
# TODO: Make more informative failure massage with difference between actual and expected
@plus3x
plus3x / ruby-puts-line.sublime-snippet
Created September 25, 2023 21:57
Sublime Snippet - Puts file line
<snippet>
<content><![CDATA[
puts ">>>>>> #{File.basename(__FILE__)}:#{__LINE__} <<<<<<"
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>puts</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>
</snippet>
@plus3x
plus3x / ruby-pry.sublime-snippet
Created September 25, 2023 21:58
Sublime Snippet - Pry
<snippet>
<content><![CDATA[
require 'pry'; binding.pry
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>pry</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ruby</scope>
</snippet>