This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails/all' | |
# require 'action_view' | |
require 'rspec/rails' | |
require 'capybara/rspec' | |
require 'capybara/rails' | |
# This file was generated by the `rails generate rspec:install` command. Conventionally, all | |
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. | |
# The generated `.rspec` file contains `--require spec_helper` which will cause | |
# this file to always be loaded, without a need to explicitly require it in any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'paint' | |
class Display | |
def self.display(args) | |
# display search results | |
@@search_result = args[:result] | |
@@options = args[:options] | |
@@search_result.each_pair do |file_name, lines| | |
display_search_result(file_name, lines) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'forwardable' | |
class UsersController < ApplicationController | |
def show | |
@user = User.find_by_id(params[:id]) | |
end | |
def new | |
@user = User.new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event < ActiveRecord::Base | |
delegate :next_occurrence, :select_events_with_time, :find_category_next_occurences :to => :OccurrenceManager | |
end | |
class OccurrenceManager | |
def self.next_occurrence(event_type, begin_time = COLLECTION_TIME_PAST.ago) | |
events_with_times = select_events_with_time(event_type: event_type, begin_time: begin_time) | |
unless events_with_times.empty? | |
events_with_times = events_with_times.sort {|e1, e2| e1.time <=> e2.time } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Module /spa/ | |
// Provides chat slider capabilities | |
var spa = (function($) { | |
var | |
/* --- Constants --- */ | |
configMap = { | |
extended_height: 434, | |
extended_title: 'Click to retract', | |
rectracted_height: 16, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const React = require('react'); | |
const ReactDOM = require('react-dom'); | |
const TodoInput = require('./todo_input.js'); | |
const TodoList = require('./todo_list.js'); | |
var tasks = [ | |
{ text : 'buy milk' }, | |
{ text : 'do exercises' } | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
var path = require('path'); | |
app.set('port', (process.env.PORT || 5000)); | |
app.use(express.static(__dirname + '/public')); | |
app.get('/', (req, res) => { | |
res.sendFile(path.join(__dirname, 'public', 'index.html')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var articles = [ | |
{ | |
title: 'Everything Sucks', | |
url: 'http://do.wn/sucks.html', | |
author: { | |
name: 'Debbie Downer', | |
email: 'debbie@do.wn' | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
square x = x * x | |
double x = x + x | |
factorial n = if n == 1 | |
then 1 | |
else n * factorial (n - 1) | |
evaluate f x = f x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
factorial :: (Integral a) => a -> a | |
factorial 0 = 1 | |
factorial n = n * factorial (n - 1) | |
maximum' [] = error "can't be empty" | |
maximum' [x] = x | |
maximum' (x:xs) = max x (maximum' xs) | |
head' :: [a] -> a | |
head' [] = error "Can't call head on an empty list" |
OlderNewer