Skip to content

Instantly share code, notes, and snippets.

View ppaulojr's full-sized avatar

Pedro Paulo Jr ppaulojr

View GitHub Profile
@benvium
benvium / MyTabBar.m
Created March 5, 2015 11:22
UITabBarController slide animation. Slide left and right when tabs are selected. Based on code from StackOverflow (linked in code)
- (BOOL) tabBarController:(UITabBarController *)tabBarController
shouldSelectViewController:(UIViewController *)viewController {
// http://stackoverflow.com/questions/5161730/iphone-how-to-switch-tabs-with-an-animation
NSUInteger controllerIndex = [self.viewControllers indexOfObject:viewController];
if (controllerIndex == tabBarController.selectedIndex) {
return NO;
}
@ept
ept / gist:4475995
Last active November 4, 2022 08:38
Syntax highlighting code for PowerPoint (Mac OS)

How to add syntax-highlighted code to PowerPoint slides (Mac OS)

  1. pygmentize -f rtf FILE | pbcopy
  2. Paste into TextEdit (in rich text mode: Format → Make Rich Text before pasting), and copy to clipboard again.
  3. In PowerPoint, Edit → Paste Special… → Styled Text.

(Pasting RTF directly into PowerPoint doesn't work correctly, at least with PowerPoint 2008 — it extends colour spans longer than it should, and sometimes removes line breaks. Going via TextEdit seems to solve the problem.)

@notbanker
notbanker / stockfish.sh
Last active November 24, 2019 16:03
Use stockfish engine to output the position evaluation only
#!/usr/bin/env bash
# Call stockfish engine on mac and return only the evaluation score
# Usage stockfish.sh 'r1b2rk1/4qppp/2pp4/pp6/3Bn3/PB3Q1P/1PP2PP1/3R1RK1' 5 mac 12 1024
# Usage stockfish.sh 'r1b2rk1/4qppp/2pp4/pp6/3Bn3/PB3Q1P/1PP2PP1/3R1RK1' 5 mac 12 1024
# Assumes the stockfish binary is called 'stockfish_'+binary
fen=$1
seconds=${2:-3}
binary=${3:-mac}
threads=${4:-12}