Skip to content

Instantly share code, notes, and snippets.

@kompozer
kompozer / vimrc
Last active October 3, 2015 15:44
Current vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
- (BOOL)stringContainsEmoji:(NSString *)string
{
__block BOOL returnValue = NO;
[string enumerateSubstringsInRange:NSMakeRange(0, [string length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
const unichar hs = [substring characterAtIndex:0];
// surrogate pair
if (0xd800 <= hs && hs <= 0xdbff) {
if (substring.length > 1) {
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@kompozer
kompozer / UIImage+AverageColor
Created December 10, 2011 12:39
Efficiently finding the average color of a UIImage. Copyright (c) 2010, Mircea "Bobby" Georgescu
/*
UIImage+AverageColor.m
Copyright (c) 2010, Mircea "Bobby" Georgescu
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
@kompozer
kompozer / gist:1454981
Created December 10, 2011 11:53 — forked from sync/gist:957132
Keep your iOS network activity indicator under control, in a *thread-safe* way. Also shows a useful means of debugging it by logging backtraces for on/off calls.
//
// KBNetworkActivityIndicator.h
// Kobov3
//
// Created by Jim Dovey on 10-03-21.
// Copyright 2010 Kobo Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@kompozer
kompozer / symbolicatecrashpatched.pl
Created December 27, 2010 09:21
symbolicatecrash patched
#!/usr/bin/perl
#
# This script parses a crashdump file and attempts to resolve addresses into function names.
#
# It finds symbol-rich binaries by:
# a) searching in Spotlight to find .dSYM files by UUID, then finding the executable from there.
# That finds the symbols for binaries that a developer has built with "DWARF with dSYM File".
# b) searching in various SDK directories.
#
// Getter and setter
var TEST = (function(exposed) {
// Underbar method
var User = exposed.User = function() {
this._name = 'teste'; // readonly
}
User.prototype = (function() {
function private() {
this._name = 'im private';
@kompozer
kompozer / .bash_profile
Created December 7, 2010 11:23
the bash_profile file for bash-it
#!/bin/bash
# Load RVM, if you are using it
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
# Add rvm gems and nginx to the path
export PATH=$PATH:~/.gem/ruby/1.8/bin:/opt/nginx/sbin:~/bin:/opt/local/bin:/opt/local/sbin
# Path to the bash it configuration
export BASH=$HOME/.bash_it
# install node wherever...
cat <<NPMRC >>$HOME/.npmrc
root = ~/.node_libraries
manroot = ~/local/share/man
binroot = ~/bin
NPMRC
curl http://npmjs.org/install.sh | sh
startup_message off
shell -${SHELL}
caption always "%n(%t) : %C"
defscrollback 1024
startup_message off
hardstatus on
hardstatus alwayslastline
setenv LC_CTYPE en_US.UTF-8
defutf8 on