Skip to content

Instantly share code, notes, and snippets.

View MaximKeegan's full-sized avatar

Maxim Keegan MaximKeegan

  • Tochka Bank
  • Yekaterinburg, Russia
View GitHub Profile
@MaximKeegan
MaximKeegan / xcode_ramdisk.sh
Created April 12, 2012 03:28
Create a RAM disk for using with XCode
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
@MaximKeegan
MaximKeegan / FadeScrollView.h
Created April 24, 2012 11:15
Fade edges UIScrollView
//
// FadeScrollView.h
// scroll_test
//
// Created by Maxim Keegan on 24.04.12.
// Copyright (c) 2012 East Media Ltd. All rights reserved.
//
#import <UIKit/UIKit.h>
array(
array(
'nid' => '12375',
'type' => 'bo_article',
'language' => 'ru',
'uid' => '426',
'status' => '1',
'created' => '1354777500',
'changed' => 1354867204,
'comment' => '2',
array(
array(
'nid' => '12405',
'type' => 'bo_article',
'language' => 'ru',
'uid' => '426',
'status' => '1',
'created' => '1354862732',
'changed' => 1354867570,
'comment' => '2',
<?php
$path_node = explode("?", substr($_SERVER["REQUEST_URI"],count(dirname($_SERVER["PHP_SELF"]))));
$path_node = urldecode($path_node[0]);
$path_chains = explode("/", $path_node);
function fucking_drupal_cant_load_node_by_url($path_node) {
// такой изподвыпердный изврат для получения PATH_INFO требуетя из-за разных настроек серверов
$query = "SELECT src FROM {url_alias} WHERE dst = '%s';";
// fuckig php have't closure!
$_result = db_query($query, $path_node);
mysql> select * from edetailing_actions;
+------+---------------------+-------------+------------+
| id | name | description | bundles_id |
+------+---------------------+-------------+------------+
| 1 | open_intro | | 16 |
| 2 | start_app | | 4 |
| 3 | first_start | | 4 |
| 4 | open_kiosk | | 16 |
| 5 | open_carousel | | 16 |
| 6 | open_book10 | | 16 |
BOOL GSFontAddFromFile(const char * path);
NSUInteger newFontCount = 0;
NSBundle *frameworkBundle = [NSBundle bundleWithIdentifier:@"com.apple.GraphicsServices"];
const char *frameworkPath = [[frameworkBundle executablePath] UTF8String];
if (frameworkPath) {
void *graphicsServices = dlopen(frameworkPath, RTLD_NOLOAD | RTLD_LAZY);
if (graphicsServices) {
BOOL (*GSFontAddFromFile)(const char *) = dlsym(graphicsServices, "GSFontAddFromFile");
if (GSFontAddFromFile) {
for (NSString *fontFile in [[NSBundle mainBundle] pathsForResourcesOfType:@"otf" inDirectory:nil])
Все плохо:
mtr -w -r -c 10 195.58.9.105
HOST: mail.east-media.ru                       Loss%   Snt   Last   Avg  Best  Wrst StDev
 1.|-- cz-eth0205-gw-86.host-telecom.com        60.0%    10    2.8   3.8   2.8   5.6   1.3
 2.|-- cz-gw-core.host-telecom.com               0.0%    10    1.5  14.5   0.3 136.5  42.9
 3.|-- gi4-43.mag01.prg01.atlas.cogentco.com     0.0%    10    2.7   3.8   2.7  12.8   3.2
 4.|-- te3-3.ccr01.prg01.atlas.cogentco.com      0.0%    10    4.2   2.9   2.6   4.2   0.5
 5.|-- te3-8.ccr01.brq01.atlas.cogentco.com      0.0%    10    7.5   6.5   6.0   8.5   0.8
 6.|-- te0-2-0-7.ccr22.bts01.atlas.cogentco.com  0.0%    10    8.6   9.6   8.6  15.2   2.0
 7.|-- te0-1-0-1.ccr21.vie01.atlas.cogentco.com  0.0%    10   10.1  10.5   9.9  12.2   0.7
RIButtonItem *cancelItem = [RIButtonItem item];
cancelItem.label = NSLocalizedString(@"Cancel",@"Cancel");
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Subscribe", @"Subscribe")
message:nil
cancelButtonItem:cancelItem
otherButtonItems:nil];
for (DPSProduct *dpsProduct in productsSet) {
RIButtonItem *purchaseItem = [RIButtonItem item];
- (IBAction)twitterButtonAction:(id)sender {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) {
if (granted) {
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
if ([accountsArray count] > 0) {
ACAccount *twitterAccount = [accountsArray lastObject];
DLog(@"%@ %@", twitterAccount.identifier, twitterAccount.username);