(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| class LinkedList(T) | |
| include Enumerable | |
| class Node(T) | |
| property :next | |
| property :data | |
| def initialize(@data : T, @next = nil) | |
| end | |
| end |
| require 'rubygems' | |
| require 'mechanize' | |
| FIRST_NAME = 'FIRST_NAME' | |
| LAST_NAME = 'LAST_NAME' | |
| PHONE = 'PHONE' | |
| EMAIL = 'EMAIL@provider.com' | |
| PARTY_SIZE = 2 | |
| SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' } |
| SetOutputFilter DEFLATE |
| #include "SDL.h" | |
| #include "SDL_image.h" | |
| #include "SDL_rotozoom.h" | |
| #ifdef EMSCRIPTEN | |
| #include "emscripten.h" | |
| #endif | |
| SDL_Surface *screen; | |
| SDL_Surface *sprite[4]; |
Partial evaluation means to fix some variables in the given code before execution. With a traditional implementation of a compiler or an interpreter, all variables are replaced with its value on each evaluation of that variable. This is because a variable can change at any timing. This is, however, not always true in actual applications. Almost all of large applications has setting variables and data
| /* | |
| * Minimal C++ implementation of Functor, Monad and Maybe. | |
| * | |
| * Requires c++0x variadic templates and lambda expressions: | |
| * | |
| * g++ -std=c++0x main.cpp -o main | |
| * | |
| * fmap, monadic bind and return implementations for std::vector | |
| * and Maybe. | |
| * |
Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).
This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.
If you want to use or share this material, please see the license file, below.
| #!/bin/bash | |
| # MacRuby | |
| rm -rf /Library/Frameworks/MacRuby.framework | |
| XCODE_DIR=`xcode-select -print-path` | |
| # tool | |
| rm -f "$XCODE_DIR"/usr/bin/rb_nibtool | |
| rm -f "$XCODE_DIR"/Tools/rb_nibtool |
| # | |
| # MIT License - (c) 2011 John Mettraux | |
| # | |
| require 'rubygems' | |
| require 'parslet' # gem install parslet | |
| module MyJson |