Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/usr/bin/env ruby | |
require 'csv' | |
require 'json' | |
if ARGV.size != 2 | |
puts 'Usage: csv_to_json input_file.csv output_file.json' | |
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects' | |
exit(1) | |
end |
// Ruby = 5.times { |i| puts i } | |
// JS = (1).times(function(i){console.log(i);}) | |
Number.prototype.times = function(cb) { | |
var i = -1; | |
while (++i < this) { | |
cb(i); | |
} | |
return +this; |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
require 'bundler/capistrano' | |
set :application, "net" | |
set :repository, "[email protected]:net.git" | |
set :scm, :git | |
set :default_environment, { | |
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" | |
} |
#ifndef DANI_AVL_TREE_H_ | |
#define DANI_AVL_TREE_H_ | |
/* | |
Balanced Binary Search Tree using AVL algorithm. | |
Depends: list.h (see github for newest version). | |
Author: Daniela Petruzalek (https://gist.github.com/danicat) | |
Date : October, 20th 2013 |
Note: This method doesn't work for multitrack game disks that I've tried, such as those that include audio files on separate tracks like Vib Ribbon.
Also don't go using this method to distribute copies of PS1 games on the internet. That's super illegal and uncool.
diskutil list
, make note of where the game disk was mounted (something like /dev/disk3
)sudo dd if=<disk> of=foo.iso
where <disk>
is the mount point we got in the last step (you can call the ISO whatever you want)const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
// Adjustments particular to this page to ensure we hit desktop breakpoint. | |
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1}); | |
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'}); |