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 Luhn = function(number) { | |
// console.log("Doing Luhn check on " + number); | |
this.checkDigit = number % 10; | |
this.addends = []; | |
this.checksum = 0; | |
// for (var i = 1; number > 0; i++) { | |
// var i = 1; | |
var double = false; | |
while (number > 0) { |
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
// app/models/task.js | |
import Backbone from 'backbone'; | |
var Task = Backbone.Model.extend({ | |
defaults: { | |
title: "Unknown Task", | |
description: "placeholder description" | |
}, | |
initialize: function() { | |
console.log("Created new task with title " + this.title); |
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
import $ from 'jquery'; | |
import _ from 'underscore'; | |
import Backbone from 'backbone'; | |
import Task from 'app/models/task'; | |
import TaskView from 'app/views/task_view'; | |
var TaskListView = Backbone.View.extend({ | |
initialize: function(options) { | |
// Compile a template to be shared between the individual tasks |
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
import $ from 'jquery'; | |
import _ from 'underscore'; | |
import Backbone from 'backbone'; | |
import TaskView from 'app/views/task_view'; | |
var TaskListView = Backbone.View.extend({ | |
initialize: function(options) { | |
// Store a the full list of tasks | |
this.taskData = options.taskData; |
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"> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/foundation/6.2.4/foundation.min.css"> | |
<link rel="stylesheet" href="styles/index.css"> | |
</head> | |
<body> | |
<main id="application" class="row"> | |
<section class="small-12 columns"> |
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
import $ from 'jquery'; | |
import _ from 'underscore'; | |
import Backbone from 'backbone'; | |
var taskData = [ | |
{ | |
title: 'Mow the lawn', | |
description: 'Must be finished before BBQ on Sat afternoon' | |
}, { | |
title: 'Go to the Bank', |
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
import $ from 'jquery'; | |
import Backbone from 'backbone'; | |
var taskData = [ | |
{ | |
title: 'Mow the lawn', | |
description: 'Must be finished before BBQ on Sat afternoon' | |
}, { | |
title: 'Go to the Bank', | |
description: 'Need to make a transfer' |
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
# For a POST-style request, sending the data in the request body | |
# Note the .to_json on the body data | |
url = 'http://localhost:1337/pets/' | |
HTTParty.post(url, | |
headers: {"Content-Type" => "application/json"}, | |
body: { "pet"=> { "name" => "spike" } }.to_json | |
) | |
# For a GET-style request, sending the data in query params | |
# (that's the stuff after the '?' in the URL) |
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
CHAR_COUNT=`rake routes | head -n 1 | sed 's/\(.*Prefix\).*/\1/' | wc -c | xargs` | |
for PREFIX in `rake routes | cut -c -${CHAR_COUNT} | awk '{$1=$1};1' | grep -v '^$' | grep -v "Prefix"` ; do | |
echo "\n" | |
echo $PREFIX | |
grep -n -i -I -d recurse --color=always "${PREFIX}_path" * | |
done |
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 class="no-js" lang="en" dir="ltr"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Foundation Demonstration</title> | |
<link rel="stylesheet" href="css/foundation.css"> | |
<link rel="stylesheet" href="css/app.css"> | |
</head> |