Skip to content

Instantly share code, notes, and snippets.

@peterflynn
peterflynn / C++ Pointer Syntax Cheatsheet.cpp
Created September 16, 2015 20:36
C++ Pointer Syntax Cheatsheet
// If "const" is to the LEFT of "*" it applies to the object being pointed at
// If "const" is to the RIGHT of "*" it applies to the variable holding the pointer address
const T* ptr; // object is immutable
T const* ptr; // "
T* const ptr; // 'ptr' cannot be changed to point to a different address, but object is not immutable
// (i.e. the variable is const, not the thing it points to)
const T* const ptr; // object is immutable AND 'ptr' cannot be changed to point to a different address
@peterflynn
peterflynn / Objective-C syntax cheatsheet.m
Last active January 3, 2017 21:55
Objective-C syntax cheatsheet
// Can omit the whole @interface section if no private fields/properties to declare
@interface MyClass () // parens are almost always empty - used only to define a "Category" when adding mixins to existing class definition
{
int foo; // private field (not common) - access as 'foo'
} // can omit these {}s if no private fields
@property (nonatomic) int foo2; // private property - access as 'self.foo2'
// Any property (private or public) can also be accessed within the class as "_foo2" (without "self"). This bypasses the getter/setter
// methods and accesses it directly like an ivar. Since the getter/setter are usually auto-generated stubs, there's usually no behavior
// difference with this syntax.
@peterflynn
peterflynn / Useful GitHub bookmarklets
Last active August 30, 2023 06:54
GitHub comment thread bookmarklets
To use: create a new bookmark and paste into the URL field.
In Chrome, you can paste the full multiline code as shown below.
In other browsers, you may need to minify the code into one line first.
@JuggoPop
JuggoPop / Git branch bash autocomplete *with aliases*
Created April 15, 2014 06:23
Git branch bash autocomplete *with aliases* (add to .bash_profile)
# To Setup:
# 1) Save the .git-completion.bash file found here:
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
# 2) Add the following lines to your .bash_profile, be sure to reload (for example: source ~/.bash_profile) for the changes to take effect:
# Git branch bash completion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
# Add git completion to aliases
@markcerqueira
markcerqueira / gist:9902072
Created March 31, 2014 20:57
CrashPlan and the Mac library folder
This file seeks to explain what should and should not be backed up from the Library folder on your Mac to minimize the amount of data sent over the wire to your backup server. Some files in the Library folder are important to backup whereas others are not critical.
There are two general strategies for handling the Library folder:
1. Start with nothing (de-select the Library folder) and selectively add files/folders
2. Start with everything and de-select files/folders we do not want to back up
Regardless of strategy, here are some things that you SHOULD back up and things you SHOULD NOT back up. Note, the exclusion list includes folders outside the Library folder that should also not be backed up.
GOOD TO BACK UP
$ cat test.js
function foo () { while (true) { } }
function bar () { return foo(); }
bar();
$ node test.js &
$ gdb attach $(pidof node)
0x00000bf778c63d5f in ?? ()
(gdb) b v8::internal::Runtime_StackGuard
Breakpoint 1 at 0x84a1f0
(gdb) print 'v8::V8::TerminateExecution'(0)
@alexpeattie
alexpeattie / disable-autolinking.md
Created February 7, 2013 07:32
Disable Github-flavored Markdown autolinking

http://example.com

http://example.com