Skip to content

Instantly share code, notes, and snippets.

@Pasta
Pasta / doc.md
Created September 5, 2016 08:53 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

// MARK: NSFetchedResultsControllerDelegate
func controllerWillChangeContent(controller: NSFetchedResultsController) {
self.tableView.beginUpdates()
}
func controller(controller: NSFetchedResultsController,
didChangeObject anObject: AnyObject,
atIndexPath indexPath: NSIndexPath?,
forChangeType type: NSFetchedResultsChangeType,
if Rails.version.to_f >= 3.1 and Rails.application.config.assets.enabled
require 'capybara/util/save_and_open_page'
module Capybara
class << self
def save_page(html, file_name=nil)
rewrite_css_assets
save_page_html(html, file_name)
end
protected
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
- (void) motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if (event.type == UIEventSubtypeMotionShake)
[[NSNotificationCenter defaultCenter] postNotificationName:@"BugsterIOMotionEventEnded" object:nil];
}
@Pasta
Pasta / Podfile.rb
Last active December 11, 2015 03:19
pod 'BugsterIO', :podspec => "https://raw.github.com/BugsterIO/BugsterIO-iOS/0.9/BugsterIO.podspec"
git clone git://github.com/BugsterIO/BugsterIO-iOS.git
git clone git@github.com:MobiTrack/sdk.git
$> git clone git://github.com/rails/rails.git
$> bundle
$> cd guides
// Download KindleGen here : http://www.amazon.com/gp/feature.html/ref=amb_link_357613502_1?ie=UTF8&docId=1000765211&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=right-4&pf_rd_r=0APNC24Q9S90B73GZP4E&pf_rd_t=1401&pf_rd_p=1343256942&pf_rd_i=1000729511 and add it to your $PATH
$> rake guides:generate:kindle
@Pasta
Pasta / gist:2908993
Created June 11, 2012 07:57
Some tests in Rspec
describe "POST create" do
context "when params are valid" do
before { @some = Some.new(name:"Vincent", lat:48.872958, lng:2.380428) }
it "should create an Thing position" do
expect {
post :create, homeless:{ name:@some.name, lat:@some.lat, lng:@some.lng }, format: :json }.to change(Some, :count).by 1
response.body.should be_json_eql(@some.to_json)
end
end
context "when invalid params" do