Skip to content

Instantly share code, notes, and snippets.

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"More" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
// maybe show an action sheet with more options
[self.tableView setEditing:NO];
}];
moreAction.backgroundColor = [UIColor lightGrayColor];
UITableViewRowAction *blurAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Blur" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self.tableView setEditing:NO];
}];
@marksands
marksands / UIKeyboardImpl.h
Created May 26, 2014 23:48
UIKeyboardImp
<UIKeyboardImpl: 0xd6cbe0>:
in UIKeyboardImpl:
Class Methods:
+ (void) applicationDidReceiveMemoryWarning:(id)arg1; (0x4136a6)
+ (void) applicationWillResignActive:(id)arg1; (0x413565)
+ (void) applicationDidEnterBackground:(id)arg1; (0x413626)
+ (void) applicationWillEnterForeground:(id)arg1; (0x413663)
+ (void) applicationWillSuspend:(id)arg1; (0x413431)
+ (id) activeInstance; (0x41332f)
+ (void) releaseSharedInstance; (0x413340)
#import "Foo.h"
@interface SomeClass : NSObject
- (id)init UNAVAILABLE_ATTRIBUTE;
- (id)initWithFoo:(id<Foo>)foo;
@end
#!/usr/bin/perl -w
# Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#include <iostream>
constexpr long long factorial(long long n) {
return n <= 1 ? 1 : n * factorial(n-1);
}
int main()
{
std::cout << factorial(20); // 2432902008176640000
}
#include <vector>
#include <iostream>
struct A {
int m;
A() {
m = 'A';
}
friend std::ostream& operator<<(std::ostream&os, A a);
};
@marksands
marksands / printc.cpp
Created June 9, 2012 18:34
Print arbitrary STL container
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <list>
namespace eds {
template <template <typename T, typename A = std::allocator<T> > class C, typename T, typename A>
void print(const C<T, A>& v) {
std::copy(v.begin(), v.end(), std::ostream_iterator<T>(std::cout, " "));
@marksands
marksands / variadic_demo.cpp
Created May 31, 2012 06:06
Variadic Templates in C++11
#include <vector>
#include <algorithm>
// -----------------------------------------------------------------------------
// Function Object - print()
// -----------------------------------------------------------------------------
namespace eds {
template <typename T>
struct print : public std::unary_function<T, void> {
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
typedef unsigned long UID_t;
class UIDGen
{
private:
@marksands
marksands / gist:2317073
Created April 6, 2012 05:02
Draw Something wordlist
aardvark,2,1
abba,3,0
acdc,3,0
ace,1,1
acorn,1,1
add,1,0
adele,3,1
africa,2,1
afro,1,1
airbag,3,0