Skip to content

Instantly share code, notes, and snippets.

@elnaqah
elnaqah / RTF In textView
Created February 24, 2014 00:40
load rtf file in UItextView
NSURL *rtfPath = [[NSBundle mainBundle] URLForResource: @"description_ar" withExtension:@"rtf"];
NSAttributedString *attributedStringWithRtf = [[NSAttributedString alloc] initWithFileURL:rtfPath options:@{NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType} documentAttributes:nil error:nil];
self.textView.attributedText=attributedStringWithRtf;
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@nghuuphuoc
nghuuphuoc / 1) Install
Last active September 4, 2023 09:29
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@tonycn
tonycn / reachability_3g_wifi
Last active December 14, 2015 18:59
Reachablility to detect 3g or wifi
self.internetReachability = [Reachability reachabilityForInternetConnection];
[self.internetReachability startNotifier];
self.wifiReachability = [Reachability reachabilityForLocalWiFi];
[self.wifiReachability startNotifier];
[AppInfo setCurrentNetworkStatus:[self statusByWifiAndInternetReachability]];
@anandkunal
anandkunal / simple_reverse_proxy.go
Created September 4, 2012 21:12
Simple reverse proxy in Go.
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
@0xced
0xced / NSString.m
Created April 1, 2012 12:24
Reverse-engineered implementation of -[NSString isEqual:] and -[NSString isEqualToString:]
/*
* Most NSString instances will actually be __NSCFString instances, so here are both NSString and __NSCFString implementations.
* If you know how to create an NSString instance whose class is actually NSString please let me know.
* Other possible concrete subclasses of NSString are: NSConstantString, __NSCFConstantString, NSPathStore2, NSSimpleCString and __NSLocalizedString.
*/
// CoreFoundation.framework 635.19.0 (Mac OS X 10.7.3)
@implementation NSObject
- (BOOL) isNSString__
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb: