This file contains hidden or 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
# This script demonstrates an issue with MongoMapper's #update_attributes!. | |
# Should call $set, but instead, just overwrites the entire doc. | |
# | |
# Script outputs: | |
# | |
# doc[:one] # => "uno" | |
# doc[:two] # => nil | |
class Doc | |
include MongoMapper::Document |
This file contains hidden or 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 'sinatra' | |
before do | |
halt 200, {'Content-Type' => 'text/plain'}, "didnt match and it doesnt matter" | |
end | |
get '/hey' do | |
"hey!" | |
end |
This file contains hidden or 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 'sinatra' | |
before do | |
params[:thing] = params[:thing].uppercase | |
end | |
get '/:thing' do | |
"You said '#{params[:thing]}'" | |
end |
This file contains hidden or 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
Move = | |
move: (modelOrIndex, endIndex) -> | |
if typeof modelOrIndex == "number" | |
this.__moveIndexTo__(modelOrIndex, endIndex) | |
else | |
this.__moveModelTo__(modelOrIndex, endIndex) | |
__moveModelTo__: (model, endIndex) -> | |
this.__moveIndexTo__ _.indexOf(this.models, model), endIndex |
This file contains hidden or 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
// ========================================================================== | |
// Project: Todos.TaskDataSource | |
// Copyright: ©2010 My Company, Inc. | |
// ========================================================================== | |
/*globals Todos */ | |
/** @class | |
(Document Your Data Source Here) |
This file contains hidden or 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 HomeApp < Sinatra::Base | |
get "/" do | |
"Hello World!" | |
end | |
end | |
My::Application.routes.draw do |map| | |
match "/en", :to => HomeApp | |
end |
This file contains hidden or 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> | |
<head> | |
<title></title> | |
<!-- Meta Info --> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="description" content="" /> | |
<meta name="keywords" content="" /> |
This file contains hidden or 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
// [~]$ g++ isLocalhost.cpp -o isLocalhost && ./isLocalhost 127.0.0.1 google.com localhost | |
// isSlocalhost(127.0.0.1) = 1 | |
// isSlocalhost(google.com) = 0 | |
// isSlocalhost(localhost) = 1 | |
// isLocalhost(127.0.0.1) = 1 | |
// isLocalhost(google.com) = 0 | |
// isLocalhost(localhost) = 1 | |
#include <netdb.h> |
This file contains hidden or 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> | |
<head> | |
<title></title> | |
<!-- Meta Info --> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="description" content="" /> | |
<meta name="keywords" content="" /> |
This file contains hidden or 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
<?xml version="1.0" encoding="iso-8859-1"?> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<style> | |
div { | |
height: 1000px; | |
} | |
body { | |
background-color: #eaeaea; |