Skip to content

Instantly share code, notes, and snippets.

💭
Never asked for this.

Paweł Gościcki pjg

💭
Never asked for this.
Block or report user

Report or block pjg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maxim
maxim / rails_load_path_tips.md
Last active Aug 21, 2019
How to use rails load paths, app, and lib directories.
View rails_load_path_tips.md

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@henrik
henrik / big_decimal_inspect.rb
Created Aug 20, 2013
Better BigDecimal#inspect. Great with tests. By @aalin.
View big_decimal_inspect.rb
class BigDecimal
def inspect
format("#<BigDecimal:%x %s>", object_id, to_s('F'))
end
end
@jsteiner
jsteiner / projections.json
Last active Nov 17, 2017
Example Rails.vim projections for an Ember.js project.
View projections.json
{
"app/assets/javascripts/models/*.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.coffee",
"template": "App.%S = DS.Model.extend"
},
"app/assets/javascripts/controllers/*_controller.coffee": {
"command": "jcontroller",
"alternate": "spec/javascripts/controllers/%s_spec.coffee",
@funny-falcon
funny-falcon / changes.md
Last active Jan 18, 2018
Performace patch for ruby-1.9.3-p327
View changes.md

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

@tomdale
tomdale / gist:3981133
Last active Apr 2, 2017
Ember.js Router API v2
View gist:3981133

WARNING

This gist is outdated! For the most up-to-date information, please see http://emberjs.com/guides/routing/!

It All Starts With Templates

An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars.

<header>
@judofyr
judofyr / fizzbuzz.rb
Created Aug 1, 2012 — forked from JEG2/fizzbuzz.rb
Writing FizzBuzz with flip-flops
View fizzbuzz.rb
a=b=c=(1..100).each do |num|
print num, ?\r,
("Fizz" unless (a = !a) .. (a = !a)),
("Buzz" unless (b = !b) ... !((c = !c) .. (c = !c))),
?\n
end
@unak
unak / history.txt
Last active Sep 25, 2019
The History of Ruby
View history.txt
* Only the releases of the stable versions are listed in principle. The releases of the unstable versions especially considered to be important are indicated as "not stable."
* The branches used as the source of each releases are specified, and the branching timing of them are also shown. BTW, before subversionizing of the repository, the term called "trunk" was not used, but this list uses it in order to avoid confusion.
* In order to show a historical backdrop, big conferences (RubyKaigi, RubyConf and Euruko) are also listed. About the venues of such conferences, general English notations are adopted, in my hope.
* ruby_1_8_7 branch was recut from v1_8_7 tag after the 1.8.7 release because of an accident.
* 1.2.1 release was canceled once, and the 2nd release called "repack" was performed. Although there were other examples similar to this, since the re-releases were performed during the same day, it does not write clearly in particular.
* Since 1.0 was released with the date in large quantities, the mi
View updates.md

Recently, we've been working on extracting Ember conventions from applications we're working on into the framework. Our goal is to make it clearer how the parts of an Ember application work together, and how to organize and bootstrap your objects.

Routing

Routing is an important part of web applications. It allows your users to share the URL they see in their browser, and have the same things appear when their friends click on the link.

The Ember.js ecosystem has several great solutions for routing. But, since it is such an important part of most web applications, we've decided to build it right into the framework.

If you have already modeled your application state using Ember.StateManager, there are a few changes you'll need to make to enable routing. Once you've made those changes, you'll notice the browser's address bar spring to life as you start using your app—just by moving between states, Ember.js will update the URL automatically.

View ember-routes.md

Routing in Ember

In Ember, the application's state manager handles routing. Let's take a look at a simple example:

App.stateManager = Ember.StateManager.create({
  start: Ember.State.extend({
    index: Ember.State.extend({
      route: "/",
You can’t perform that action at this time.