The simplest way to traverse the hierarchy tree with Baum is by iterating through the children
relation.
<?php
$root = Category::roots()->with('children')->first();
echo "<h3>{$root->name}</h3>";
foreach($root->children as $category) {
{ | |
// Sets the colors used within the text area | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
// Note that the font_face and font_size are overriden in the platform | |
// specific settings file, for example, "Base File (Linux).sublime-settings". | |
// Because of this, setting them here will have no effect: you must set them | |
// in your User File Preferences. | |
"font_face": "Monaco", | |
"font_size": 12, |
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
use Illuminate\Database\Capsule\Manager as DB; | |
use Baum\Node; | |
// Initialize Capsule | |
$capsule = new DB; | |
// Add connection settings |
The simplest way to traverse the hierarchy tree with Baum is by iterating through the children
relation.
<?php
$root = Category::roots()->with('children')->first();
echo "<h3>{$root->name}</h3>";
foreach($root->children as $category) {
# Build-tools + Git | |
sudo apt-get install build-essential git-core | |
# Install required libraries & tools | |
sudo apt-get install bison openssl libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf | |
# -- SQLite3 support | |
sudo apt-get install libsqlite3-0 libsqlite3-dev sqlite3 | |
# -- PostgreSQL support |
/* | |
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js | |
*/ | |
var http = require('http'), | |
fs = require('fs'), | |
util = require('util'); | |
http.createServer(function (req, res) { | |
var path = 'video.mp4'; |
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
use Illuminate\Database\Capsule\Manager as DB; | |
use Baum\Node; | |
// Initialize Capsule | |
$capsule = new DB; | |
// Add connection settings |
#!/bin/bash | |
BUNDLED_COMMANDS="${BUNDLED_COMMANDS:- | |
cap | |
capify | |
cucumber | |
foreman | |
guard | |
haml | |
heroku |
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations) | |
# By Peter Cooper | |
# | |
# MIT license | |
# | |
# * Not advised to use in your production environment! ;-) | |
# * Requires Ruby 1.9 | |
# * Supports A and CNAME records | |
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance | |
# * All records get the same TTL |
class Person | |
@name = nil | |
# class-level reader | |
# cattr_accessor is rails-specific not ruby, and uses class vbles so ... | |
# may be done like this too: | |
# | |
# class << self | |
# attr_reader :name | |
# end |
# encoding: utf-8 | |
require 'pp' | |
class Point | |
attr_accessor :x, :y | |
def initialize(x=0.0, y=0.0) | |
@x = x | |
@y = y | |
end |