Skip to content

Instantly share code, notes, and snippets.

View lisovskyvlad's full-sized avatar

Lisovskii Vladislav lisovskyvlad

View GitHub Profile
@emaraschio
emaraschio / SOLID.markdown
Last active February 16, 2025 23:43
SOLID Principles with ruby examples

SOLID Principles with ruby examples

SRP - Single responsibility principle

A class should have only a single responsibility.

Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.

OCP - Open/closed principle

Software entities should be open for extension, but closed for modification.

@nateberkopec
nateberkopec / gist:11dbcf0ee7f2c08450ea
Last active March 24, 2023 21:59
RubySpec is dead, long live RubySpec!

Last night, Brian Shirai unilaterally "ended" the RubySpec project, a sub-project of Rubinius (the alternative Ruby implementation which Brian was paid to work on full-time from 2007 to 2013). The blog post describing his reasons for "ending" the project led to a big discussion on Hacker News.

When a single, competing Ruby implementation tells that you its test suite is the One True Way, you should be skeptical. Charles Nutter, Ruby core committer and JRuby head honcho, spent a lot of time last night on Twitter talking to people about what this decision means. He's probably too busy and certainly too nice of a guy to write about what is a political issue in the Ruby community, so I'm going to do it on behalf of all the new or intermediate Rubyists out there that are confused by Brian's decision and what it me

RUBY_GC_HEAP_FREE_SLOTS=600000
RUBY_GC_HEAP_GROWTH_FACTOR=1.25
RUBY_GC_HEAP_GROWTH_MAX_SLOTS=300000
RUBY_GC_HEAP_INIT_SLOTS=600000
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.3
RUBY_GC_MALLOC_LIMIT=64000000
RUBY_GC_OLDMALLOC_LIMIT=64000000
RUBY_HEAP_FREE_MIN=12500
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
RUBY_HEAP_SLOTS_INCREMENT=100000
@gbuesing
gbuesing / ml-ruby.md
Last active December 3, 2024 08:13
Resources for Machine Learning in Ruby

UPDATE a fork of this gist has been used as a starting point for a community-maintained "awesome" list: machine-learning-with-ruby Please look here for the most up-to-date info!

Resources for Machine Learning in Ruby

Gems

@mpakus
mpakus / gist:b969bce8b12ff2ec3bdf
Created October 8, 2014 05:01
select date angularjs directive (using: <div selectdate yu-model="user.birthdate_on"></div>)
.directive "selectdate", ($translate)->
restrict: 'A'
scope:
yuModel: '='
controller: ($scope, $element) ->
$scope.months = [
{value: 1, name: 'jan'},
{value: 2, name: 'feb'},
{value: 3, name: 'mar'},
{value: 4, name: 'apr'},
@kachayev
kachayev / concurrency-in-go.md
Last active January 6, 2025 22:43
Channels Are Not Enough or Why Pipelining Is Not That Easy
@Killavus
Killavus / ugly_code_refactoring.coffee
Last active March 14, 2022 17:52
Example of possible refactoring of badly written code - loading photos and making it grayed after click
Photos = {}
class Photos.App
constructor: ->
@gui = new Photos.Gui($("#photos-list"))
@backend = new Photos.Backend()
start: =>
@backend.fetchPhotos()
.done(
@arr-ee
arr-ee / core.clj
Created July 4, 2014 22:16
Tiny Instapaper scraper
(ns instagroup.core
(:require [net.cgrand.enlive-html :as html]
[clj-http.client :as http]
[clj-http.cookies :as cookies]
[clojure.java.io :as io]
[clojure.string :as s]
[clojure.pprint :as pp])
(:import java.io.ByteArrayInputStream)
(:gen-class))
@abyx
abyx / angular-error-handling.js
Last active February 4, 2022 19:19
AngularJS HTTP Error Handling Mechanism
var HEADER_NAME = 'MyApp-Handle-Errors-Generically';
var specificallyHandleInProgress = false;
angular.module('myApp').factory('RequestsErrorHandler', ['$q', function($q) {
return {
// --- The user's API for claiming responsiblity for requests ---
specificallyHandled: function(specificallyHandledBlock) {
specificallyHandleInProgress = true;
try {
return specificallyHandledBlock();
@staltz
staltz / introrx.md
Last active April 19, 2025 05:15
The introduction to Reactive Programming you've been missing