Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Turner lefticus

View GitHub Profile
View A_View_To_a_Thing.md

A View to a Thing

Jason Turner

  • Host of C++ Weekly
  • Co-host of CppCast
  • Speaker / Contractor / Trainer
View codingstandards-0-automatedanalysis.md

THIS DOCUMENT

IS OUT OF

DATE

See https://github.com/lefticus/cppbestpractices/blob/master/00-Table_of_Contents.md Instead!

C++ Coding Standards Part 0: Automated Code Analysis

Automated analysis is the main advantage to working with a modern statically typed compiled language like C++. Code analysis tools can inform us when we have implemented an operator overload with a non-canonical form, when we should have made a method const, or when the scope of a variable can be reduced.

@lefticus
lefticus / get_llvm.sh
Last active Dec 16, 2019
A script for building LLVM
View get_llvm.sh
if [ $# -gt 1 ]
then
echo "Checking out LLVM '$1' branch from svn into '`pwd`/llvm' and setting install prefix to '$2'"
echo "Press Return To Continue"
read $VAR
else
echo "Usage: $0 <branch name> <install prefix>"
exit
fi
View chaiscript_basic_example.cpp
#include <chaiscript/chaiscript.hpp>
std::string helloWorld(const std::string &t_name) {
return "Hello " + t_name + "!";
}
int main() {
chaiscript::ChaiScript chai;
chai.add(chaiscript::fun(&helloWorld), "helloWorld");
@lefticus
lefticus / iife.cpp
Last active Feb 5, 2019
Immediately-invoked Function Expressions in C++
View iife.cpp
#include <chrono>
#include <string>
#include <sstream>
#include <vector>
#include <iostream>
std::string to_string(const int i)
{
std::stringstream ss;
ss << i;
View run_ci.rb
#!/usr/bin/env ruby
require 'fileutils'
if ARGV.length < 4
puts "Usage: #{__FILE__} <buildfolder> [options] <testruntrueorfalse> <githubtoken> <repositoryname> (<repositoryname> ...)"
abort("Not enough arguments")
end
puts "starting CI system"
@lefticus
lefticus / chaiscript_inheritance.cpp
Created Oct 13, 2014
Example of Emulating Inheritance in ChaiScript and Sharing with C++
View chaiscript_inheritance.cpp
#include <chaiscript/chaiscript.hpp>
#include <chaiscript/chaiscript_stdlib.hpp>
class BaseClass
{
public:
BaseClass()
{
}
View get_gcc.sh
git clone git://gcc.gnu.org/git/gcc.git
mkdir gcc_build
cd gcc_build
../gcc/configure --disable-bootstrap --disable-werror --disable-multilib --enable-languages=c,c++ --prefix=/usr/local
make -j3
make install
View chaiscript_errorhandling.chai
// ChaiScript's primary error handling is exceptions, just like C++, and uses C++
// exceptions internally. This means that exceptions can be shared / passed / handled
// between ChaiScript and C++
// catching chaiscript errors inside of chaiscript
try {
eval("BLARG")
} catch (e) {
print("Error while processing eval statement"))
}
@lefticus
lefticus / vimrc
Last active Feb 25, 2017
My Personal vimrc File
View vimrc
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2008 Jul 02
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
You can’t perform that action at this time.