Skip to content

Instantly share code, notes, and snippets.

View otanistudio's full-sized avatar

Robert Otani otanistudio

View GitHub Profile
@otanistudio
otanistudio / fix_mangled_xcode
Last active April 11, 2016 16:24
Sometimes, the XCode's editor gets so messed up that we can't get work done. http://blog.otanistudio.com/post/142635021213/fix-mangled-xcode-editor
#!/bin/bash
cd `dirname "$0"`/..
set -e
USER_STATE_FILE="Mix.xcodeproj/project.xcworkspace/xcuserdata/$USER.xcuserdatad/UserInterfaceState.xcuserstate"
if [ -w $USER_STATE_FILE ]; then
mv $USER_STATE_FILE /var/tmp/
echo "Moved '$USER_STATE_FILE' to /var/tmp/; Check XCode before deleting in case you need to move it back."
else
@otanistudio
otanistudio / tabs-pre-commit
Created April 1, 2014 00:43
git pre-commit hook for checking tabs, but only in certain files. Just as an example, this one only looks for Obj-C, Obj-C++, C++, JSON and header files
if
git diff --cached --name-only | egrep '(\.(mm|m|h|cpp|json)$)' | xargs git diff --cached | egrep '^\+.*'$'\t' > /dev/null
then
echo "Tabs found in your commit. Please use (four) spaces and re-commit."
exit 1
fi
@otanistudio
otanistudio / license.txt
Created June 5, 2012 23:14
Hey ladies and dudes, here's a quick typing indicator thing. Depends on any $ lib.
MIT License
Copyright (c) 2012 @otanistudio
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE O
@otanistudio
otanistudio / chat-frontend.js
Created June 2, 2012 04:45 — forked from martinsik/chat-frontend.js
Node.js chat server, with the frontend changed to use BackboneJS
/*global $, Backbone, window, console, WebSocket, _ */
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var $content = $('#content')
, $input = $('#input')
, $status = $('#status')
// my color assigned by the server