Skip to content

Instantly share code, notes, and snippets.

View esbanarango's full-sized avatar
👨‍🚀
Desayunando

Esteban esbanarango

👨‍🚀
Desayunando
View GitHub Profile
@ryanto
ryanto / gist:a3ae9cc8119ca0f2f235
Last active October 29, 2015 12:04
Declarative CPs
import Ember from 'ember';
export default Ember.Component.extend({
channelTalk: null,
classNames: 'Channel-table-row',
channel: Ember.computed.readOnly('channelTalk.channel'),
talk: Ember.computed.readOnly('channelTalk.talk'),
@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:

@imjasonh
imjasonh / markdown.css
Last active January 3, 2025 20:15
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@edymerchk
edymerchk / active_admin.js.coffee
Last active December 2, 2015 13:15
active_admin custom js page scope
# app/assets/javascripts/active_admin.js.coffee
#= require active_admin/base
ActiveAdmin = {
dashboard: {},
user: {}
}
ActiveAdmin.dashboard.index = () ->
console.log 'Hello'
@youssman
youssman / regex-camelCase-to-dash.js
Created November 5, 2014 11:19
Javascript convert camelcase to dash (hyphen)
function camelCaseToDash( myStr ) {
return myStr.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase();
}
var myStr = camelCaseToDash( 'thisString' );
alert( myStr ); // => this-string
@kristianmandrup
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active March 12, 2025 04:26
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.

When you modify a file in your repository, the change is initially unstaged. In order to commit it, you must stage it—that is, add it to the index—using git add. When you make a commit, the changes that are committed are those that have been added to the index.

git reset changes, at minimum, where your current branch is pointing. The difference between --mixed and --soft is whether or not your index is also modified. So, if we're on branch master with this series of commits:

- A - B - C (master)

HEADpoints to C and the index matches C.

--soft

@staltz
staltz / introrx.md
Last active April 19, 2025 05:15
The introduction to Reactive Programming you've been missing
@bendyorke
bendyorke / setup.md
Last active March 12, 2021 14:25
Setting up a new mac

Welcome in many languages (in JSON format)

Today I wanted to implement a multi-language greeter for an application, and I ended up on http://www.omniglot.com/language/phrases/welcome.htm

I extracted all the welcomes from the page using jQuery, serialized them as JSON and processed them using Ruby:

welcomes = x.inject({}) {|h, (lang, val)| val.gsub!(/(.?)/, ''); vals = val.split(%r{\s+/\s+|\n}); vals.map! {|val| val.strip!; val.gsub!(/^\w+ -\s+|- \w+$|^lit.|>.+$/, ''); val.strip!; val}; vals.flatten!; vals.reject!(&:blank?);; h.update(lang => vals) }