Skip to content

Instantly share code, notes, and snippets.

View macmade's full-sized avatar
🦄
I may be slow to respond.

JD Gadina macmade

🦄
I may be slow to respond.
View GitHub Profile
@macmade
macmade / CFPP
Created March 8, 2014 16:53
CoreFoundation++ Example
{
CF::Number number = 42;
CF::URL url = externalURL;
CF::Array array;
/* Adds number and URL to the array */
array << number << url;
CF::Data data
(
@macmade
macmade / strict-aliasing-bug.c
Created April 2, 2014 21:38
An example of C99 strict aliasing issue...
#include <stdio.h>
struct s1
{
int i;
};
struct s2
{
int i;
@macmade
macmade / libgit2-coveralls.c
Last active August 29, 2015 14:16
libgit2 - coveralls.io infos
/*!
* @author Jean-David Gadina
* @copyright (c) 2015, Jean-David Gadina - www.xs-labs.com
*/
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "git2.h"
@macmade
macmade / cpp-fibs.cpp
Created June 11, 2015 22:20
C++ Fibonacci
#include <iostream>
template< int N >
struct Fibonacci
{
static constexpr int value = Fibonacci< N - 1 >::value + Fibonacci< N - 2 >::value;
};
template<>
struct Fibonacci< 1 >
@macmade
macmade / ArchInfos
Created November 26, 2010 21:12
C / System informations
#include <stdio.h>
#define XSTR(s) STR(s)
#define STR(s) #s
int main( void )
{
printf
(
"\n"
@macmade
macmade / ASM Universe
Created November 26, 2010 20:05
The whole universe, coded with 236 characters of assembly code...
BITS 16
before_big_bang:
cli
mov ax, 0x07C0
mov ds, ax
mov es, ax
@macmade
macmade / objc-clang-warnings
Created November 18, 2011 15:00
Objective-C Clang Warning Flags
‎-Wall
-Wbad-function-cast
-Wcast-align
-Wconversion
-Wdeclaration-after-statement
-Wdeprecated-implementations
-Wextra
-Wfloat-equal
-Wformat=2
-Wformat-nonliteral
@macmade
macmade / BashStory
Created November 22, 2011 18:58
BashStory - When I tried to SSH my girlfriend
Girlfriend/BSD
Login: love
Password:
Login incorrect
Login: boyfriend
Password:
int * x;
int * y;
int z;
x = ( int * )calloc( 10, sizeof( int ) );
y = &( x[ 5 ] );
x = ( int * )realloc( x, 20 * sizeof( int ) );
z = *( y );
- ( void )actionSheet: ( UIActionSheet * )actionSheet clickedButtonAtIndex: ( NSInteger )buttonIndex
{
NSLog( @"%i", buttonIndex );
if( buttonIndex == 0 )
{
SettingsView * settings = [ [ SettingsView alloc ] initWithNibName: @"SettingsView" bundle: nil ];
NSLog( @"%@", settings );
NSLog( @"%@", self.navigationController );
[ self.navigationController pushViewController: settings animated: YES ];
[ settings release ];