Skip to content

Instantly share code, notes, and snippets.

View dmitry-ilyashevich's full-sized avatar

Dzmitry Ilyashevich dmitry-ilyashevich

View GitHub Profile
@steveklabnik
steveklabnik / summary.md
Created September 29, 2015 14:39
my summary of "using Rust with Ruby: a deep dive with Yehuda Katz"

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:

System

  1. Set up iCloud Keychain
  2. Remove icons and hide Dock
  3. Default address in iMessage
  4. Install Updates
  5. Add Ru Input Sources
  6. Set up Shortcuts
  7. Add text shortcuts Text
@ericelliott
ericelliott / essential-javascript-links.md
Last active April 22, 2024 10:15
Essential JavaScript Links
@essen
essen / http_specs.md
Last active January 10, 2022 02:01
HTTP and related specifications
@pcreux
pcreux / 000_postgresql_fancy_datatypes
Last active March 18, 2022 16:51
Postgresql fancy datatypes with Rails / ActiveRecord. Run it with `rake`!
# Postgresql fancy datatypes!
* array
* hstore (=~ hash)
* json
* jsonb
Philippe Creux - [@pcreux](http://twitter.com/pcreux)
@kavu
kavu / swift.sh
Last active June 20, 2017 02:58
Minimal Swift command line Hello World
#!/bin/sh
# So you've installed XCode 6 Beta
# Now we could use Swift toolchain to build a minimal
# command line Hellow World
# let's set new Developer Toolchain bundled with Xcode6-Beta.app
# as default toolchain
# sudo xcode-select -s /Applications/Xcode6-Beta.app/Contents/Developer
# alias for Swift binary
@carlwoodward
carlwoodward / ember_websocket_adapter.js
Created January 27, 2014 23:49
A simple websocket adapter for ember-js.
Web.Store = DS.Store.extend();
DS.WebsocketAdapter = DS.RESTAdapter.extend({
callbacks: {},
socket: null,
beforeOpenQueue: [],
ajax: function(url, type, params) {
var adapter = this;
var uuid = adapter.generateUuid();
@cviebrock
cviebrock / select2-foundation5.css
Created December 20, 2013 15:56
Select2 CSS for Zurb Foundation 5
/*
Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
*/
.select2-container {
margin: 0 0 1rem 0;
position: relative;
vertical-align: middle;
font-family: inherit;
-webkit-appearance: none !important;
font-size: 0.875rem;
@Myuzu
Myuzu / secure_random.ex
Last active August 7, 2022 20:09
Elixir ruby-like SecureRandom
# UPD from 2018:
# This gist was written for pre-1.0 version of Elixir and won't work on post-1.0 versions.
# You probably consider using something else!
defmodule SecureRandom do
@moduledoc """
Ruby-like SecureRandom module.
## Examples
@ericboehs
ericboehs / gist:7125105
Created October 23, 2013 19:30
Poltergeist hack to silence CoreText performance notes from phantomjs
module Capybara::Poltergeist
class Client
private
def redirect_stdout(to)
prev = STDOUT.dup
prev.autoclose = false
$stdout = to
STDOUT.reopen(to)
prev = STDERR.dup