#Assignment:
Create a controller for a robot
RightForward | ||
Left | 0 |
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" | |
npm ERR! node v4.8.4 | |
npm ERR! npm v2.15.11 | |
npm ERR! path ../coffee-script/bin/coffee | |
npm ERR! code EINVAL | |
npm ERR! errno -22 | |
npm ERR! syscall symlink | |
npm ERR! EINVAL: invalid argument, symlink '../coffee-script/bin/coffee' -> '/exercism/node_modules/lineman/node_modules/.bin/coffee' |
def update | |
find_user | |
if @user.update_attributes(user_params) | |
respond_to do |format| | |
format.html { | |
redirect_to admin_user_path(@user) | |
flash[:notice] = 'User updated' | |
} | |
format.js { |
tracking = DateTime.strptime(row['tracking'], '%Y%m%d%H%M%S') | |
Correspondence.where( | |
tracking: tracking, | |
sender: row['remetente'], | |
receiver: row['destinatario']).first_or_create( | |
tracking: tracking, | |
sender: row['remetente'], | |
receiver: row['destinatario'], | |
department: row['depto'], | |
bay: row['baia'], |
#!/bin/bash | |
set -e | |
git reflog -n100 --pretty='%cr|%gs' --grep-reflog='checkout: moving' HEAD | { | |
seen=":" | |
git_dir="$(git rev-parse --git-dir)" | |
while read line; do | |
date="${line%%|*}" | |
branch="${line##* }" | |
if ! [[ $seen == *:"${branch}":* ]]; then |
#Assignment:
Create a controller for a robot
RightForward | ||
Left | 0 |
// | |
// Backbone.Rails.js | |
// | |
// Makes Backbone.js play nicely with the default Rails setup, i.e., | |
// no need to set | |
// ActiveRecord::Base.include_root_in_json = false | |
// and build all of your models directly from `params` rather than | |
// `params[:model]`. | |
// | |
// Load this file after backbone.js and before your application JS. |
# alternative to what is explained in the article Ruby Blocks as Dynamic Callbacks: | |
# http://www.mattsears.com/articles/2011/11/27/ruby-blocks-as-dynamic-callbacks | |
class Callbacks | |
def initialize(block) | |
block.call(self) | |
end | |
def callback(message, *args) | |
callbacks[message].call(*args) |
Showdown.extensions['twitter'] = function(converter) { | |
return [ | |
// Replace escaped @ symbols | |
{ type: 'lang', regex: '\\@', replace: 'red' } | |
]; | |
} |
# Patch for ransack (https://github.com/ernie/ransack) to use scopes | |
# Helps migrating from Searchlogic or MetaSearch | |
# Place this file into config/initializer/ransack.rb of your Rails 3.2 project | |
# | |
# Usage: | |
# class Debt < ActiveRecord::Base | |
# scope :overdue, lambda { where(["status = 'open' AND due_date < ?", Date.today]) } | |
# end | |
# | |
# Ransack out of the box ignores scopes. Example: |
require 'lib/scrubyt' | |
@extractor = Scrubyt::Extractor.new do | |
fetch "http://www.google.com/search?&q=ruby" | |
books "ul.results li" do | |
title "//h2" | |
author "p.author" | |
book_detail "h2 a" do | |
name "//title" | |
summary "//p[1]" | |
end |