Skip to content

Instantly share code, notes, and snippets.

View AlexDenisov's full-sized avatar
🇺🇦
Talking to Machines

AlexDenisov AlexDenisov

🇺🇦
Talking to Machines
View GitHub Profile
@Jaybles
Jaybles / UIDeviceHardware.h
Created October 28, 2011 19:33
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;
@skeeet
skeeet / xcode_ramdisk.sh
Created April 12, 2012 13:35 — forked from MaximKeegan/xcode_ramdisk.sh
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"
@AlexDenisov
AlexDenisov / calabash-ios-ci.rb
Created May 24, 2012 06:31
Ruby script for Calabash iOS CI-server
#!/usr/bin/ruby
require "getoptlong"
getoptlong = GetoptLong.new(
[ '--target', '-t', GetoptLong::REQUIRED_ARGUMENT ],
[ '--log-file', '-l', GetoptLong::REQUIRED_ARGUMENT ],
[ '--source-root', '-r', GetoptLong::REQUIRED_ARGUMENT ]
)
@jordiboehme
jordiboehme / gist:3168819
Created July 24, 2012 08:25
iOS Pixel-to-Points conversion
+(CGFloat)pixelToPoints:(CGFloat)px {
CGFloat pointsPerInch = 72.0; // see: http://en.wikipedia.org/wiki/Point%5Fsize#Current%5FDTP%5Fpoint%5Fsystem
CGFloat scale = 1; // We dont't use [[UIScreen mainScreen] scale] as we don't want the native pixel, we want pixels for UIFont - it does the retina scaling for us
float pixelPerInch; // aka dpi
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
pixelPerInch = 132 * scale;
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
pixelPerInch = 163 * scale;
} else {
pixelPerInch = 160 * scale;
@bellbind
bellbind / Info.plist.json
Created July 25, 2012 08:22
[macosx][ios][objective-c]Building iOS 5.1 app with command line (completely Xcode-less programming)
{"UIDeviceFamily":[1,2]}
@AlexDenisov
AlexDenisov / svn_aliases.sh
Created November 6, 2012 11:54
Useful aliases for SVN
alias subadd="svn st | grep '^?' | sed 's/^? *\(.*\)/\"\1\"/g' | sed 's/@\(.*\)/@\1@/g' | xargs svn add"
alias subrm="svn st | grep '^!' | sed 's/^! *\(.*\)/\"\1\"/g' | sed 's/@\(.*\)/@\1@/g' | xargs svn rm"
alias subst='svn st'
alias subci='svn ci'
alias subup='svn up'
@AlexDenisov
AlexDenisov / install.md
Last active February 10, 2021 03:26
This script creates PDF from man page and opens it within Preview.app. Only Mac OS X.

pman

Generates PDF from man page and opens it within Preview.app.

Install

curl -o /usr/local/bin/pman https://gist.githubusercontent.com/AlexDenisov/4294335/raw/9fe40c81f6fc94760e81040d2636d0e703fc676f/pman.pl
chmod +x /usr/local/bin/pman

Usage

@mbostock
mbostock / .block
Last active November 7, 2023 07:54
Collapsible Tree
license: gpl-3.0
redirect: https://observablehq.com/@d3/d3-collapsible-tree
@AlexDenisov
AlexDenisov / iterate_each_array.pl
Created January 23, 2013 08:44
Iterate few lists with Perl
use List::MoreUtils qw( each_array );
my @first = qw( foo bar buzz );
my @second = (1, 2, 3);
my $it = each_array( @first, @second );
while ( my ($f, $s) = $it->() ) {
print "$f = $s\n";
}
//
// UIDevice+DeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
#include <sys/types.h>
#include <sys/sysctl.h>
typedef enum {