Accept json posts in the following formats:
POST /posts
jsonapi.org plural rooted document:
{"things":[{"name": "My Name", "location": "here"}]}
Accept json posts in the following formats:
POST /posts
jsonapi.org plural rooted document:
{"things":[{"name": "My Name", "location": "here"}]}
Basically the angular_templates
helper method creates script tags like
<script type="app/x-angular-template" name="whichever_app/templates/foo">
template code here as html with {{}}s etc
</script>
We then reference that in angular with jQuery via $("script[name='whichever_app/templates/foo']").html()
.
# Enable syntax-highlighting in less. | |
# Last tested on CentOS 6.3. | |
# | |
# First, add these two lines to ~/.bashrc | |
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" | |
# export LESS=" -R " | |
sudo yum -y install boost boost-devel ctags | |
wget http://springdale.math.ias.edu/data/puias/unsupported/6/x86_64/source-highlight-3.1.6-3.puias6.x86_64.rpm |
You can break these rules if you can talk your pair into agreeing with you.
require 'rspec' | |
describe "Behaviour" do | |
it "should pass" do | |
true.should eq true | |
end | |
it "should fail" do | |
true.should eq false | |
end |
#define MAX_STEPS 100000 | |
#define NO_SOLUTION -1 | |
int arrayJump(int *A, int size) { | |
int *p = A, steps = 0; | |
while (++steps < MAX_STEPS && A <= (p+=*p) && p < A+size); | |
return steps >= MAX_STEPS ? NO_SOLUTION : steps; | |
} |
class AccountsController < ApplicationController | |
def update | |
@account = Account.find(params[:id]) | |
respond_to do |format| | |
if @account.update_attributes(account_params) | |
format.html { redirect_to @account, notice: 'Account was successfully updated.' } | |
else | |
format.html { render action: "edit" } | |
end |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
# Terminal Progress Indicators. Four examples are included: percentage, | |
# spinner, progress bar, and combined. This script has been tested on | |
# Mac OS X 10.8 with Ruby 1.8.7, 1.9.1, 1.9.2, and 1.9.3 | |
class Spinner | |
include Enumerable | |
def each | |
loop do | |
yield '|' | |
yield '/' |
angular.module('bDatepicker', []). | |
directive('bDatepicker', function(){ | |
return { | |
require: '?ngModel', | |
restrict: 'A', | |
link: function($scope, element, attrs, controller) { | |
var updateModel; | |
updateModel = function(ev) { | |
element.datepicker('hide'); | |
element.blur(); |