Skip to content

Instantly share code, notes, and snippets.

@fnichol
fnichol / README.md
Created February 26, 2012 01:23
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@fetep
fetep / config
Created March 6, 2012 14:45
sample logstash config for rails log line
input {
stdin {
type => rails
}
}
filter {
grok {
type => "rails"
pattern => "Completed %{GREEDYDATA:operation} in %{NUMBER:time:int}ms"
@lukemelia
lukemelia / config.ru
Created March 23, 2012 03:26
rake pipeline rack config
require 'bundler/setup'
require 'sass'
require 'compass'
require 'rake-pipeline'
require 'listen'
require 'rack/lock'
require 'ruby-debug'
require 'securerandom'
STDOUT.sync = true
@srinivasmohan
srinivasmohan / whatsmyname.rb
Last active October 3, 2015 18:27
Chef recipe (snippets) to setup FQDN, hostname, IP etc properly
#Knife invocations supply FQDN as the node name at creation time and this becomes hostname( option -N)
execute "Configure Hostname" do
command "hostname --file /etc/hostname"
action :nothing
end
#Ensure the hostname of the system is set to knife provided node name
file "/etc/hostname" do
content node.name
@rlivsey
rlivsey / 1-helper.js
Created May 3, 2012 19:53 — forked from wagenet/1-helper.js
Ember Handlebars Transform Helper
Ember.HandlebarsTransformView = Ember.View.extend(Ember._Metamorph, {
rawValue: null,
transformFunc: null,
value: function(){
var rawValue = this.get('rawValue'),
transformFunc = this.get('transformFunc');
return transformFunc(rawValue);
}.property('rawValue', 'transformFunc').cacheable(),
@lancejpollard
lancejpollard / index.md
Created May 22, 2012 06:32
Notes on Ember.js overcomplicating...

Some random notes on the pangs of ember. Will be expanding as they are uncovered.

Building a form

Say you have a form that maps to a model, something like:

<form>
  <fieldset>
    <legend>Who are you?</legend>

Relationship Semantics

The new relationship semantics change the current app/store/transaction/adapter APIs in several ways:

Changes to the Application API

At present, a record can be freely moved across transactions as long as it has no changes. Once a record accumulates at least one change, an application cannot move it out of its current transaction until the transaction is committed or rolled back.

@sundbp
sundbp / notes
Created August 2, 2012 11:30
Notes for binding_of_caller jruby support
- Perhaps can get to it without any java code: https://gist.github.com/1680784
- Interpreter only flags: https://github.com/quix/boc/blob/master/jext/boc/BocService.java
Code sections that are relevant:
- Kernel#binding: return RubyBinding.newBinding(context.runtime, context.currentBinding());
- ThreadContext:
- 1223 public Binding currentBinding(IRubyObject self) {
- 1224 Frame frame = getCurrentFrame();
- 1225 return new Binding(self, frame, frame.getVisibility(), getRubyClass(), getCurrentScope(), backtrace[backtraceIndex].clone());
@rlivsey
rlivsey / nav_section_mixin.coffee
Created August 9, 2012 10:54
Dynamic navigation with Ember.js
App.NavSectionMixin = Ember.Mixin.create({
enter: (router, context) ->
router.set("sectionNavigationController.current", @get("section"))
@_super(router, context)
exit: (router, context) ->
router.set("sectionNavigationController.current", null)
@_super(router, context)
})
@headius
headius / gist:3758342
Created September 20, 2012 21:02
Startup times for base and loading ActiveRecord on JDK7 an JDK8 with various flags
Java 7 does not currently have tiered compilation on by default, and we do not enable invokedynamic.
Default settings (no indy, no tiered)
system ~/projects/jruby $ (pickjdk 4 ; time jruby -e 1)
New JDK: jdk1.7.0_07.jdk
real 0m1.255s
user 0m1.953s
sys 0m0.084s