Skip to content

Instantly share code, notes, and snippets.

View paulstefanort's full-sized avatar

Paul Ort paulstefanort

View GitHub Profile
@paulstefanort
paulstefanort / building-bots-meetup-1.md
Last active October 4, 2017 14:34
Building Bots Meetup #1
@paulstefanort
paulstefanort / gist:6055207
Created July 22, 2013 16:18
Reload environment variables on OS X.
grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl
@paulstefanort
paulstefanort / gist:3840912
Created October 5, 2012 16:43
UINavigationController - switch directly from one view to another
// (http://stackoverflow.com/questions/410471/how-can-i-pop-a-view-from-a-uinavigationcontroller-and-replace-it-with-another-i)
// locally store the navigation controller since
// self.navigationController will be nil once we are popped
UINavigationController *navController = self.navigationController;
/* Not necessary with ARC
// retain ourselves so that the controller will still exist once it's popped off
[[self retain] autorelease];
*/
@paulstefanort
paulstefanort / gist:3656489
Created September 6, 2012 13:54
Hide keyboard when leaving focus on iOS controls
@interface ViewController
@end
@implementation ViewController
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[firstControl resignFirstResponder];
[secondControl resignFirstResponder];
[thirdControl resignFirstResponder];
// ...
}
@paulstefanort
paulstefanort / gist:1348744
Created November 8, 2011 19:00
Vim Shortcuts
# Remove the last character of each line in the file:
:%s/.$//
@paulstefanort
paulstefanort / gist:1348585
Created November 8, 2011 18:10
Apache VirtualHost: Redirect Domain
RewriteEngine On
RewriteRule ^/(.*)$ http://www.newdomain.com [R=301,L]
@paulstefanort
paulstefanort / .osx
Created September 8, 2011 18:57
Mac OS X Lion Modifications
# Originally from https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Enable the 2D Dock
defaults write com.apple.dock no-glass -bool true
# Disable menu bar transparency
defaults write -g AppleEnableMenuBarTransparency -bool false
# Expand save panel by default
defaults write -g NSNavPanelExpandedStateForSaveMode -bool true
@paulstefanort
paulstefanort / gist:1172067
Created August 25, 2011 21:44
Yii: Ajax Button: Prevent Multiple JS onclick Bindings
<?php
/* From http://stackoverflow.com/questions/5039494/yii-ajax-button-how-to-prevent-multiple-js-onclick-bindings */
echo CHtml::submitButton($diary->isNewRecord ? 'Создать' : 'Сохранить', array('id' => 'newRecSubmit'));
Yii::app()->clientScript->registerScript('btnNewRec', "
var clickNewRec = function()
{
jQuery.ajax({
'success': function(data) {
$('#ui-tabs-1').empty();
$('#ui-tabs-1').append(data);