This code implements a naive JSON writer in C++ complying with RFC 4627. I wrote this as I believe it is a very good example of a real life problem involving lots of C++ constructs. This sample only supports writing JSON and does not support heterogenous ‘object’ serialization and extension are left as an exercice. See Writing json in C++ for some details.
json_stream
: astd::ofstream
wrapper fulfilling RFC 4627 constraints;utf8_json
: some code to decode/“json encode”std::string
UTF-8 buffersjson_test.cpp
: a very simple program testing the code
This file contains 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'commander/import' | |
program :version, '0.1' | |
program :description, 'Converts markdown documents into a variety of default formats using Pandoc' | |
CMD = "pandoc" | |
BIB = "$HOME/Dropbox/Documents/bibtex/all-refs.bib" | |
This file contains 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
#ifndef PROFILER | |
#define PROFILER | |
#include <map> | |
#include <string> | |
#include <utility> | |
#include <fstream> | |
#include <iomanip> | |
#include <osg/Timer> |
This file contains 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
set $id=0 | |
set $numVertices = geom.getVertexArray()->getNumElements() | |
while $id < geom.getNumPrimitiveSets() | |
set $primitive = geom.getPrimitiveSet($id) | |
set $primitive_size = $primitive->getNumIndices() | |
printf "processing primitive n.%d (mode: %d, type: %d, size: %d)", $id, $primitive->getMode(), $primitive->getType(), $primitive_size | |
set $ii = 0 | |
while $ii < $primitive_size | |
if $primitive->index($ii) >= $numVertices | |
printf "primitive %d has wrong index (%d >= %d) at index %d", $id, $primitive->index($ii), $numVertices, $ii |
Git hooks for better pivotal integration:
pre-commit
:- prevents commiting on a branch that is not suffixed by an issue number. Some special branches (
develop
,master
) andhotfix
es are not constrained - lints modified python files and exits upon non correctly formatted modules
- other formats (js, scss) have pending code that is not currently called as the workflow for front code is not clear
- prevents commiting on a branch that is not suffixed by an issue number. Some special branches (
prepare-commit-msg
: prepend issue number to commit message if it's missing and if it is set in the branch name (seepre-commit
hook)post-checkout
: [optional] automatically update submodules when checkouting a branch (requires to define theAUTO_SUBMODULE_UPDATE
environment variable)
For easy setup:
This file contains 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
#!/bin/bash | |
CXXFLAGS="-pipe" cmake ../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_INSTALL_PREFIX=`pwd`/build -DCMAKE_DEBUG_POSTFIX='' -DBUILD_OSG_ANIMATIONTEST=NO -DOSG_WINDOWING_SYSTEM=Cocoa -DBUILD_OSG_EXAMPLES=NO -DwxWidgets_CONFIG_EXECUTABLE=wxWidgets_CONFIG_EXECUTABLE-NOTFOUND -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk | |
make | |
source debug_env.sh |
This file contains 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
before :each do | |
@url = 'http://sns.us-east-1.amazonaws.com:80/?Action=ListTopics&Signature=ItTAjeexIPC43pHMZLCL7utnpK8j8AbTUZ3KGUSMzNc%3D&AWSAccessKeyId=123456&Timestamp=123&SignatureVersion=2&SignatureMethod=HmacSHA256' | |
EventMachine::MockHttpRequest.reset_registry! | |
EventMachine::MockHttpRequest.reset_counts! | |
EventMachine::MockHttpRequest.pass_through_requests = false #set to false to not hit the actual API endpoint | |
end | |
it 'should be able to access the API endpoint' do |
addpart
: Informs the Linux kernel of new partitionagetty
: Alternative Linux getty; handles tty, login, shellarch
: print machine architectureblkid
: Locate/print block device attributesblockdev
: Call block device ioctls from the command linecal
: Displays a calendarcfdisk
: Curses based disk partition table manipulatorchcpu
: Configure CPUschfn
: Change your finger informationchkdupexe
: Find duplicate executables
This file contains 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
#include <iostream> | |
class B; | |
class A | |
{ | |
public: | |
A () | |
{ std::cout << "A::A ()" << std::endl; } |