Skip to content

Instantly share code, notes, and snippets.

View mikina's full-sized avatar
🤓

Mike Mikina mikina

🤓
View GitHub Profile
@mikina
mikina / clean_up
Created May 11, 2013 10:00
Clean up mac start disk
1. Remove Speech Voices
cd /System/Library/Speech/
sudo rm -rf Voices/*
2. Delete All System Logs in OS X
sudo rm -rf /private/var/log/*
3. Delete QuickLook Caches
@mikina
mikina / placeholder.js
Created May 3, 2013 12:43
Quick and dirty placeholder text in JS
function checkclear(what){
if(!what._haschanged){
what.value='';
}
what._haschanged=true;
}
<input onfocus="checkclear(this)" />
@mikina
mikina / slider.js
Created May 3, 2013 12:42
jQuery slider with fixed position
var sliderValue = [2, 3, 4, 26, 39, 52, 65];
$(function() {
$( "#slider" ).slider({
value:0,
min: 0,
max: 6,
step: 1,
slide: function( event, ui ) {
$( "#amount" ).val( sliderValue [ ui.value ] );
@mikina
mikina / iPhone simulator path
Created April 24, 2013 11:02
iPhone simulator path
~/Library/Application Support/iPhone Simulator/
@mikina
mikina / timestamp to date
Created April 24, 2013 10:52
Timestamp to date
NSTimeInterval _interval = [dateattr doubleValue];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
n.date_ = date;
@mikina
mikina / Merge no ff
Created April 15, 2013 08:53
Git - merge no ff The --no-ff flag causes the merge to always create a new commit object, even if the merge could be performed with a fast-forward.
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff myfeature
Updating ea1b82a..05e9557
(Summary of changes)
$ git branch -d myfeature
Deleted branch myfeature (was 05e9557).
@mikina
mikina / OSX_fast_sleep
Created March 30, 2013 18:15
OSX fast sleep
To check how osx manage sleep, type:
pmset -g | grep hibernatemode
hibernatemode = 3 - saves all memory to disk
hibernatemode = 0 - keep memory active all the time
To get super fast sleep, just type:
sudo pmset -a hibernatemode 0
require 'iconv'
class String
def to_permalink
Iconv.iconv('ascii//translit//IGNORE', 'utf-8', self).first.gsub("'", "").gsub(/[^\x00-\x7F]+/, '').gsub(/[^a-zA-Z0-9-]+/, '-').gsub(/^-/, '').gsub(/-$/, '').downcase
end
end