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
desc "Pings PING_URL to keep a dyno alive" | |
task :dyno_ping do | |
require "net/http" | |
uri = URI("YOUR SITE") | |
response = Net::HTTP.get_response(uri) | |
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
angular.module("User", ["ngResource"]) | |
function UserController($scope, $resource) { | |
User = $resource("/users.json") | |
$scope.users = User.query(); | |
$scope.addUser = function() { | |
entry = User.save({name:$scope.newUser.name}) | |
$scope.users.push(entry); | |
$scope.newUser.name = ';' |
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
<div ng-controller="UserController"> | |
<ul> | |
<li ng-repeat="user is users"> | |
{{ user.name }} | |
</li> | |
</ul> | |
<form> | |
<input type="text" ng-model="newUser.name" placeholder="name"> | |
<button ng-click="addUser()">Add User</button><br> | |
<span>{{newUser.name}}</span> |
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 UsersController < ApplicationController | |
respond_to :json | |
def index | |
respond_with User.all | |
end | |
def create | |
respond_with User.create(params[:user]) | |
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
require 'fis/test' | |
include Fis::Test | |
class Dog | |
attr_accessor :name, :species, :colors, :fur_length | |
def initialize(attributes_hash) | |
attributes_hash.each { |k,v| self.send ("#{k}=").to_sym, v } | |
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
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" > | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content ="width=device-width, minimum-scale=1.0, initial-scale=1.0"> | |
<title>The Flatiron School</title> | |
<link rel='stylesheet' href="/css/style.css" type='text/css' media='all' /> |
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
<!-- # views/students/students.erb --> | |
<!-- Begin Title Content --> | |
<div class="page-title"> | |
<h2>Every Story Has Villains</h2> | |
<h3>We're <%= @students.size %> people on a journey to learn to smell code.</h3> | |
</div> | |
<!-- End Title Content --> |
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
hash.each do |key, value| | |
hash.delete(key) if value.nil? | |
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
big_array = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] | |
big_array.inject(:lcm) |
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 MyApp | |
def call(env) | |
puts "hello from MyApp" | |
[200, {}, ["Hello"]] | |
end | |
end | |
class ContentType | |
def initialize(app) | |
@app = app |
NewerOlder