This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a container from the mongo image, | |
# run is as a daemon (-d), expose the port 27017 (-p), | |
# set it to auto start (--restart) | |
# and with mongo authentication (--auth) | |
# Image used is https://hub.docker.com/_/mongo/ | |
docker pull mongo | |
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth | |
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception) | |
# add a root user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//clang++ -std=c++11 -stdlib=libc++ -framework Foundation nsarray.mm -o nsarray | |
/* Note: | |
* - libstdc++ has been frozen by Apple at a pre-C++11 version, so you must opt | |
for the newer, BSD-licensed libc++ | |
* - Apple clang 4.0 (based on LLVM 3.1svn) does not default to C++11 yet, so | |
you must explicitly specify this language standard. */ | |
/* @file nsarray.mm | |
* @author Jeremy W. Sherman | |
* | |
* Demonstrates three different approaches to converting a std::vector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface ViewController () | |
@property (strong, nonatomic) UIScrollView* vScrollView; | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pbpaste | egrep '\.[0-9]+ms' | sort -t "." -k 1 -n | tail -10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//\n//.+\n//.+\n//\n//.+\n// Copyright.+$\n//\n\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find -E $(xcode-select --print-path) -regex '.*___\.(c|h|m|swift)' -print0 | xargs -0 -n 1 sed -i '' '1,/^$/d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
For example, you use Core Data sqlite. | |
It is necessary, because sqlite database stores data in single file. | |
Whole database is single file. | |
Now you have two options. | |
1. Delete all data from all tables | |
2. Delete database sqlite file | |
Second option is clean but complex. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)resetCoreData { | |
DDLogInfo(@"[RESET-COREDATA] Started."); | |
[MagicalRecord cleanUp]; | |
NSURL *storeURL = [NSPersistentStore MR_urlForStoreName:kMobilStoreName]; | |
NSURL *walURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-wal"]; | |
NSURL *shmURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-shm"]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was nice and fast... but it takes up WAY TOO MUCH space. And it's annoying to write. | |
(I like the way I can just step into the function that calls the delegate for debugging) | |
What's a better way to not make me call respondsToSelector in the middle of my code? Some proxy? | |
struct { | |
unsigned int delegateWillDisplayDocument:1; | |
unsigned int delegateDidDisplayDocument:1; | |
unsigned int delegateDidShowPageView:1; | |
unsigned int delegateDidRenderPageView:1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"coordinates":null, | |
"truncated":false, | |
"created_at":"Tue Aug 28 21:16:23 +0000 2012", | |
"favorited":false, | |
"id_str":"240558470661799936", | |
"in_reply_to_user_id_str":null, | |
"entities":{ | |
"urls":[ |