Skip to content

Instantly share code, notes, and snippets.

View listochkin's full-sized avatar

Андрей Листочкин (Andrei Listochkin) listochkin

View GitHub Profile
@fxposter
fxposter / base.rb
Created October 22, 2015 11:19
Default Rails template
View base.rb
# rails new app_name -d mysql --skip-bundle -m path/to/this/template.rb
comment_lines 'Gemfile', "gem 'turbolinks'"
comment_lines 'Gemfile', "gem 'jbuilder'"
comment_lines 'Gemfile', "gem 'sass-rails'"
comment_lines 'Gemfile', "gem 'coffee-rails'"
comment_lines 'Gemfile', "gem 'uglifier'"
comment_lines 'Gemfile', "gem 'sdoc'"
gsub_file 'Gemfile', "gem 'mysql2'", "gem 'mysql2', '~> 0.3.20'"
@rwjblue
rwjblue / 01_README.md
Last active December 1, 2015 15:57
Canary Base
View 01_README.md
@steveklabnik
steveklabnik / summary.md
Created September 29, 2015 14:39
my summary of "using Rust with Ruby: a deep dive with Yehuda Katz"
View summary.md

My summary of https://www.youtube.com/watch?v=IqrwPVtSHZI

TL;DR:

Rails has a library, ActiveSupport, which adds methods to Ruby core classes. One of those methods is String#blank?, which returns a boolean (sometimes I miss this convention in Rust, the ?) if the whole string is whitespace or not. It looks like this: https://github.com/rails/rails/blob/b3eac823006eb6a346f88793aabef28a6d4f928c/activesupport/lib/active_support/core_ext/object/blank.rb#L99-L117

It's pretty slow. So Discourse (which you may know from {users,internals}.rust-lang.org) uses the fast_blank gem, which provides this method via a C implementation instead. It looks like this: https://github.com/SamSaffron/fast_blank/blob/master/ext/fast_blank/fast_blank.c

For fun, Yehuda tried to re-write fast_blank in Rust. Which looks like this:

@timcharper
timcharper / Makefile
Created September 20, 2015 21:33
multirust source downloader
View Makefile
# Save this file to ~/.multirust/Makefile
# to run, cd ~/.multirust; make toolchains/1.3.0/src
.PHONY: clean
rust.git:
git clone https://github.com/rust-lang/rust.git --bare
toolchains/nightly/src: toolchains/master/src
ln -sf $$(pwd)/toolchains/master/src $$(pwd)/$@
View mixin-test.js
import Ember from 'ember';
import StartExamMixin from '../../../mixins/start-exam';
import { module, test } from 'qunit';
import sinon from 'sinon';
const {
RSVP,
ActionHandler
} = Ember;
View gist:64ef5320e87c4b09772a
Thank you for extending an invitation to speak at HighLoad++. I
sincerely appreciate your consideration.
I am an outspoken advocate for LGBTQ equality; this position is deeply
woven into my work. Clojure From The Ground Up is adamantly
LGBT-inclusive. Jepsen is named after a gay pop anthem and includes
dozens of references to same-sex relationships and trans identities. My
talk slides are populated with bearded nuns, genderqueer punks, and
trans hackers. My twitter feed is about as gay as it is possible to get.
@beshkenadze
beshkenadze / errors_monitoring_service.md
Last active August 29, 2015 14:23
Compare the services to collect errors.
View errors_monitoring_service.md
View smart-wrapper.js
// Have some complicated non-React widgets that manipulate DOM?
// Do they manage a list of DOM elements? Here's how to wrap it
// into a React component so you can "constantly rerender" it.
// A dumb non-react widget that manually manage some DOM node that
// represent a list of items
function NonReactWidget(node) {
this.node = node;
}
View gist:61935031ff729f072d9b

When a beginner asks you "when do I use semi-colons?" would you rather say this?

// what people who say "use semicolons!!" say
class Foo {
  prop = {
  }; // yes