Skip to content

Instantly share code, notes, and snippets.

View roustem's full-sized avatar

Roustem Karimov roustem

View GitHub Profile
#import <AddressBook/AddressBook.h>
static NSString* defaultEmail()
{
NSString* result = @"";
@try {
ABPerson *me = [[ABAddressBook sharedAddressBook] me];
if (me == nil) return result;
@roustem
roustem / ipad2.sh
Created March 24, 2011 18:02
Check for iPad 2 availability in Canadian Apple Store
#! /bin/bash
while [ 1 ]
do
curl -s 'http://store.apple.com/ca/browse/home/shop_ipad/family/ipad/select?mco=MjE2MjYyNzA' | grep -i "Currently unavailable" > /dev/null
if [ $? == 0 ]; then
echo "`date` — not available"
else
echo "`date` — available"
say "iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available! iPad 2 Is Available!"
break
# Colors from http://wiki.archlinux.org/index.php/Color_Bash_Prompt
# misc
NO_COLOR='\e[0m' #disable any colors
# regular colors
BLACK='\e[0;30m'
RED='\e[0;31m'
GREEN='\e[0;32m'
YELLOW='\e[0;33m'
BLUE='\e[0;34m'
MAGENTA='\e[0;35m'
@roustem
roustem / gist:1186829
Created September 1, 2011 18:11
Bug in NSJSONSerialization
//
// main.m
// JSONTrouble
//
// Created by Roustem Karimov on 11-08-31.
// Copyright (c) 2011 AgileBits. All rights reserved.
//
#import <Foundation/Foundation.h>
@roustem
roustem / gist:1498185
Created December 19, 2011 18:01
TextMate 2 .tm_properties

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@roustem
roustem / run_onepassword_beta.rb
Created January 19, 2012 19:20
run_onepassword_beta.rb
#!/usr/bin/env ruby
BETA_URL = "http://i.agilebits.com/dist/1P/mas/1PasswordBeta.app.zip"
local_timestamp_filename = File.expand_path("~/.onepassword_beta_timestamp")
last_modified_local = ""
if File.exists?("/Applications/1PasswordBeta.app")
File.open(local_timestamp_filename, "r") { |f| last_modified_local = f.read() } rescue nil
end
@roustem
roustem / gist:2022128
Created March 12, 2012 14:04 — forked from rcw3/gist:2018059
Self-contained WWDC Status Checker Hack
#!/bin/bash
#
# add to crontab
# */5 * * * * /Users/YOURNAME/bin/wwdc >/dev/null
#
# URL="http://www.cnn.com"
URL="http://developer.apple.com/wwdc/"
@roustem
roustem / gist:2138065
Created March 20, 2012 16:42
PBKDF2 based on OpenSSL implementation
static int PKCS5_PBKDF2_HMAC(CCHmacAlgorithm algorithm, int digestLength, const char *pass, int passlen,
const unsigned char *salt, int saltlen, int iter,
int keylen, unsigned char *out)
{
unsigned char digtmp[digestLength], *p, itmp[4];
int cplen, j, k, tkeylen;
unsigned long i = 1;
CCHmacContext ctx;
@roustem
roustem / userstyle.css
Created May 31, 2013 16:27
userstyle.css for Flowdock (~/Library/Application Support/Flowdock/userstyle.css)
@media screen {
* {
font-family: "Helvetica Neue";
font-weight: 500;
}
#inbox * {
font-family: "Helvetica Neue";
font-size: 9pt;
line-height:12pt;
//
// NSObject+Blocks.h
// Filemator
//
// Created by Zachary Waldowski on 4/12/11.
// Copyright 2011 Dizzy Technology. All rights reserved.
//
@interface NSObject (Blocks)