As configured in my dotfiles.
start new:
tmux
start new with session name:
| // Found this snippet at: https://gist.github.com/creationix/707146 | |
| // Load the TCP Library | |
| net = require('net'); | |
| // Keep track of the chat clients | |
| var clients = []; | |
| // Start a TCP Server |
| #import <Foundation/Foundation.h> | |
| @interface Communicator : NSObject <NSStreamDelegate> { | |
| @public | |
| NSString *host; | |
| int port; | |
| } | |
| - (void)setup; |
| public abstract class BaseAdapter<T, VH extends BaseViewHolder<T>> extends RecyclerView.Adapter<VH> { | |
| private List<T> items; | |
| // Missing: setItems(), addItem(), removeItem(), ... | |
| @Override | |
| public final void onBindViewHolder(VH vh, int position) { | |
| T item = items.get(position); | |
| vh.performBind(item, position); |
| public abstract class BaseAdapter<T, VH extends BaseViewHolder<T>> extends RecyclerView.Adapter<VH> { | |
| private List<T> items; | |
| // Missing: setItems(), addItem(), removeItem(), ... | |
| @Override | |
| public final void onBindViewHolder(VH vh, int position) { | |
| T item = items.get(position); | |
| vh.performBind(item, position); |
| public class ReactiveTextViewHolder<T> extends ReactiveViewHolder<T> { | |
| private TextView label; | |
| private T currentItem; | |
| public ReactiveTextViewHolder(View itemView) { | |
| super(itemView); | |
| label = (TextView) itemView.findViewById(android.R.id.text1); | |
| } |
| /** | |
| * Created by Ishank Gulati on 14/10/16. | |
| * Observer as per Observer design pattern. | |
| */ | |
| public interface RVObserver { | |
| void update(RecyclerViewItemClickListener listener); | |
| } |
| - (void) notifyMessage: (NSString*) sender withMessage: (NSString*) message { | |
| // source: http://useyourloaf.com/blog/local-notifications-with-ios-10/ | |
| NSLog(@"BackgroundServerice: Send a notification!"); | |
| message = message?message:@""; | |
| UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; | |
| // Create a content | |
| UNMutableNotificationContent *content = [UNMutableNotificationContent new]; | |
| content.title = sender; | |
| content.body = [ NSString stringWithCString:[ message cStringUsingEncoding:NSUTF8StringEncoding ] |
| // source: https://stackoverflow.com/a/3207959/1012775 | |
| NSSortDescriptor *highestToLowest = [NSSortDescriptor sortDescriptorWithKey:@"self" ascending:NO]; | |
| [mutableArrayOfNumbers sortUsingDescriptors:[NSArray arrayWithObject:highestToLowest]]; |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| @interface Singleton : NSObject | |
| @end | |
| @implementation Singleton | |
| + (instancetype)sharedInstance { | |
| static Singleton *sharedInstance = nil; | |
| static dispatch_once_t onceToken; | |
| dispatch_once(&onceToken, ^{ |