Skip to content

Instantly share code, notes, and snippets.

View berkus's full-sized avatar
🎯
Haptic drift

Berkus Decker berkus

🎯
Haptic drift
View GitHub Profile
app-admin/logrotate clang
app-admin/sudo clang
app-admin/syslog-ng clang
app-arch/bzip2 clang
app-arch/cpio clang
app-arch/file-roller clang
app-arch/gzip clang
app-arch/lha clang
app-arch/libarchive clang
app-arch/lz4 clang
#include <iostream>
using namespace std;
class VirtBase
{
public:
virtual void test() = 0;
};
class Derived : public VirtBase
@berkus
berkus / build.sh
Last active August 29, 2015 14:01
Clang EFI PECOFF problem
../toolchain/clang/bin/clang
-target i686-pc--coff
-I./include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include
-std=c++11
-ffreestanding
-fno-stack-protector
-fpic
-fshort-wchar
-fno-exceptions
-Wall -Wextra -Wno-unused-private-field -Wno-ignored-attributes
@berkus
berkus / gist:4f3a6d1a25ccfddceedf
Last active August 29, 2015 14:02
Get class name in libclang.py See http://szelei.me/code-generator/ for details.
for c in translation_unit.cursor.get_children():
if (c.kind == clang.cindex.CursorKind.CLASS_DECL):
className = c.spelling
@berkus
berkus / gist:36dc64f8f3432de1d95d
Last active August 29, 2015 14:02
constexpr alloc
#include <iostream>
class Boo
{
public:
static constexpr char const* string_of_kind[5] = {"FREE", "EXEC", "READ", "WRITE", "INITRD"};
};
constexpr char const* Boo::string_of_kind[];
protocol ISubscriber {
typealias Element
func sendNext(e: Element)
func sendError(e: NSError)
func sendCompleted()
}
/// Wraps RACSubscriber
class Subscriber<T: AnyObject> : ISubscriber {
@berkus
berkus / boost.sh
Last active August 29, 2015 14:07 — forked from rsobik/boost.sh
#===============================================================================
# Filename: boost.sh
# Author: Pete Goodliffe
# Copyright: (c) Copyright 2009 Pete Goodliffe
# Licence: Please feel free to use this, with attribution
# Modified version
#===============================================================================
#
# Builds a Boost framework for the iPhone.
# Creates a set of universal libraries that can be used on an iPhone and in the
@berkus
berkus / introrx.md
Last active August 29, 2015 14:08 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

// * a variable sized field, where size is controlled by external bitfield with certain mapping
// - where this bitfield is
// - offset of bits
// - mask of bits
// - mapping function (bits to type)
#include <array>
#include <iostream>
#include <boost/asio/buffer.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/for_each.hpp>
@berkus
berkus / gist:bd3d38587676aa707816
Last active August 29, 2015 14:16
Pepyatka OSX dev setup

Prereqs

  • OSX 10.10.2
  • homebrew
  • development branch of pepyatka-server/pepyatka-html

Install nvm

brew install nvm