Skip to content

Instantly share code, notes, and snippets.

View mwbrooks's full-sized avatar
🏠
Working from home

Michael Brooks mwbrooks

🏠
Working from home
View GitHub Profile
typeof NaN === 'number' // true
Infinity === 1/0 // true
0.1 + 0.2 === 0.3 // false
# Are you using the BASH shell?
echo $SHELL # /bin/bash
#
# Day-to-day shortcuts for the BASH shell
# ---------------------------------------
#
# up/down arrows => View your command history
#
# tab => Auto-complete file and directory names from ...
# Show all tags
git tag
# Create tag
git tag <tag_name> <branch_name - default is current branch>
# Checkout a tag
git checkout <tag_name>
// Method Signature
//
- (BOOL)searchFor:(NSString *)string
direction:(BOOL)forward
caseSensitive:(BOOL)caseFlag
wrap:(BOOL)wrapFlag
// Selector (Method Name)
//
searchFor:direction:caseSenstitive:wrap
# Local Branch
# ============
# Create
git branch my_feature
git checkout -b my_feature
# Delete
git branch -d my_feature
# Remote Branch
#include <typeinfo>
using namespace std;
int myNumber = 5;
const char *name1 = typeid(int).name(); // i on gcc, int on VSC++
const char *name2 = typeid(myNumber).name(); // i on gcc, int on VSC++
// Uncomment to disable assertions.
// NDEBUG macro must be defined before #include <assert.h>
// #define NDEBUG
#include <assert.h>
int main (int argc, char * const argv[]) {
int *goodInteger = new int(2);
int *badInteger = NULL;
#include <cstdio> // printf function
class SuperClass
{
public:
SuperClass(int foo)
{
printf("SuperClass constructor fired with value %d\n", foo);
}
};
#include <cstdio>
// Class Definition
//
class MyClass
{
public:
void print(int value1, int value2 = 200);
};
@mwbrooks
mwbrooks / PhoneGapDelegate.m
Created April 22, 2010 07:26
PhoneGap-iPhone Viewport Issue
//
// A quick and dirty fix to issue #51
//
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
CGRect windowFrame = [ [ UIScreen mainScreen ] bounds ];
CGRect webViewFrame = [ [ UIScreen mainScreen ] applicationFrame ];
webViewFrame.origin = windowFrame.origin;
self.window = [ [ [ UIWindow alloc ] initWithFrame:windowFrame ] autorelease ];