Skip to content

Instantly share code, notes, and snippets.

@csabapalfi
csabapalfi / gist:a389dff6654eea6396bc
Last active February 1, 2016 05:49
Get pngs from a multipage pdf
# get pdftk from here: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.6-setup.pkg
pdftk dashboard_UX_v3.graffle.pdf burst
# sips is built in to OSX
ls *.pdf | xargs -I '{}' sips -s format png '{}' --out '{}'.png
@natecook1000
natecook1000 / NSTimer+Closure.swift
Last active July 12, 2024 05:11
Scheduled NSTimer with a Swift closure
extension NSTimer {
/**
Creates and schedules a one-time `NSTimer` instance.
- Parameters:
- delay: The delay before execution.
- handler: A closure to execute after `delay`.
- Returns: The newly-created `NSTimer` instance.
*/
@kristopherjohnson
kristopherjohnson / reconfigureVisibleCells.m
Last active January 16, 2020 18:59
Update visible cells from a UITableViewController without calling -[UITableView reloadData]
- (void)reconfigureVisibleCells
{
NSInteger sectionCount = [self numberOfSectionsInTableView:self.tableView];
for (NSInteger section = 0; section < sectionCount; ++section) {
NSInteger rowCount = [self tableView:self.tableView numberOfRowsInSection:section];
for (NSInteger row = 0; row < rowCount; ++row) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
# tmux-mouse-toggle
# via http://qiita.com/kawaz/items/7b15e18ca8e072c1dc57
if [[ -n $TMUX ]]; then
if [[ -z "$(tmux show-options -gw mode-mouse | grep off)" ]]; then
tmux set-option -gq mouse-utf8 off
tmux set-option -gq mouse-resize-pane off
tmux set-option -gq mouse-select-pane off
tmux set-option -gq mouse-select-window off
tmux set-window-option -gq mode-mouse off
@cyndibaby905
cyndibaby905 / NSNUll+ InternalNullExtention.m
Created March 28, 2014 09:23
NSNUll+ InternalNullExtention.m
#define NSNullObjects @[@"",@0,@{},@[]]
@interface NSNull (InternalNullExtention)
@end
@implementation NSNull (InternalNullExtention)
@Olegas
Olegas / gist:9143277
Last active May 26, 2016 04:52
iOS hover-click problem solution.
/**
* Solution for http://stackoverflow.com/questions/21786375/ios-7-hover-click-issue-no-click-triggered-in-some-cases
*/
$(document).ready(function(){
if (/* if this is not iOS */) {
return;
}
var $body = $('body');
@dominik-hadl
dominik-hadl / gdbGetStrippedSymbols.sh
Last active December 20, 2015 06:08
This script automates the setup of gdb on a stripped applicaiton adds symbols. It uses objc-symbols to get the symbols, then SymTabCreator and finally creates a command that is automatically loaded into gdb on start.
#!/bin/sh
# gdbGetStrippedSymbols.sh
# @author Dominik Hadl (@dominikhadl)
# @description This script automates the setup of gdb on a stripped applicaiton adds symbols. It uses objc-symbols to get the symbols,
# then SymTabCreator and finally creates a command that is automatically loaded into gdb on start.
# @license Licensed under WTFPL license (see http://www.wtfpl.net/txt/copying/ for full license).
# @dependencies
# 1. objc-symbols
# 2. SymTabCreator
# 3. gdb (really non-obvious)
@fabiofl
fabiofl / gist:5873100
Created June 27, 2013 00:41
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@bittib
bittib / SerializingBinaryTree.java
Created May 21, 2013 15:59
Serialize and Deserialize a Binary Tree (pre order).
class TreeNode{
int val;
TreeNode left, right;
TreeNode(int val){
this.val = val;
}
}
public String serialize(TreeNode root){
StringBuilder sb = new StringBuilder();
@Kapeli
Kapeli / gist:5017177
Created February 22, 2013 22:43 — forked from yjsoon/gist:3474117
" Search Dash for word under cursor
function! SearchDash()
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
let s:url = "dash://".s:wordUnderCursor
let s:cmd ="silent ! " . s:browser . " " . s:url
execute s:cmd
redraw!
endfunction
map <leader>d :call SearchDash()<CR>