Skip to content

Instantly share code, notes, and snippets.

View skhaz's full-sized avatar
:octocat:
It's 5.50 a.m.... Do you know where your stack pointer is?

Rodrigo Delduca skhaz

:octocat:
It's 5.50 a.m.... Do you know where your stack pointer is?
View GitHub Profile
@skhaz
skhaz / hack.sh
Created April 2, 2012 16:18 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@skhaz
skhaz / gist:2172956
Created March 23, 2012 17:22
Example of the MonoState pattern
#include <iostream>
#include <boost/shared_ptr.hpp>
class VideoManagerPrivate {
private:
friend class VideoManager;
VideoManagerPrivate() { }
bool init(int _width, int _height, short _bpp, bool _fullscreen) {
import os
import sys
import pyttsx
def main():
engine = pyttsx.init()
for root, dirs, filenames in os.walk('.'):
for filename in filenames:
basename, extension = os.path.splitext(filename)
fullpath = os.path.abspath(os.path.join(root, filename))
"""
https://github.com/coffin/coffin/blob/master/coffin/template/defaulttags.py
"""
class SpacelessExtension(Extension):
"""Removes whitespace between HTML tags, including tab and
newline characters.
Works exactly like Django's own tag.
"""
std::map<std::string, std::string> result;
std::string str("foo=bar&color=red&zoom=22.5&alpha=3,4,2,1222.8");
sregex pair = ( (s1= +_w) >> "=" >> (s2= +(set[alnum | '_' | '.' | ',']) ))
[ ref(result)[s1] = s2];
sregex rx = pair >> *('&' >> *(pair));
if(regex_match(str, rx)) {
class Size
{
public:
Size();
Size(uint width, uint height);
const Size& setWidth(uint width);
const Size& setHeight(uint height);
uint width() const;
uint height() const;
private: