This template let's you easily implement a property getter like this:
- (UIView *)myView {
if (!_myView) {
_myView = [UIView new];
}
return _myView;
}
| // | |
| // AppleMediaKeyController.h | |
| // | |
| // Modified by Gaurav Khanna on 8/17/10. | |
| // SOURCE: http://github.com/sweetfm/SweetFM/blob/master/Source/HMediaKeys.h | |
| // | |
| // | |
| // 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, |
| [ -f $HOME/.profile ] && . $HOME/.profile | |
| HISTSIZE=1000 | |
| SAVEHIST=1000 | |
| HISTFILE=$HOME/.zsh_history | |
| setopt append_history | |
| setopt inc_append_history | |
| setopt extended_history | |
| setopt hist_find_no_dups | |
| setopt hist_ignore_all_dups |
| Контролируемое скачивание файлов через rails 2 в связке с nginx. | |
| Используется заголовок X-Accel-Redirect nginx'а, который делает так, | |
| что файл отдаёт не приложение, а сам сервер, таким образом на приложение | |
| меньше нагрузки. | |
| Ссылки по теме: | |
| http://groups.google.com/group/ror2ru/browse_thread/thread/1733088704f9278e - | |
| обсуждение в группе ror2ru | |
| http://wiki.nginx.org/XSendfile |
| #!/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" |
| -(float) get_free_memory { | |
| mach_port_t host_port; | |
| mach_msg_type_number_t host_size; | |
| vm_size_t pagesize; | |
| host_port = mach_host_self(); | |
| host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); | |
| host_page_size(host_port, &pagesize); | |
| vm_statistics_data_t vm_stat; | |
| if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) { |
| In order for this to work you need ffmpeg. I tried with version 1.2.1. | |
| 1) Play the video you want to download in the browser | |
| 2) Inspect the video element on the page | |
| 3) Copy the video url from the page source (something like http://devstreaming.apple.com/videos/wwdc/2013/.../101/ref.mov) | |
| 4) In this url replace "ref.mov" with "iphone_c.m3u8" (for 960x540 resolution) or "atp.m3u8" if you want more (probably 720p?) | |
| 5) Execute `ffmpeg -y -i http://devstreaming.apple.com/videos/wwdc/2013/.../101/iphone_c.m3u8 output.mp4` | |
| 6) There is your video :) |
| void (^stubResponseWithHeaders)(NSString *, NSString *, NSDictionary *); | |
| void (^stubResponse)(NSString *, NSString *); | |
| void (^stubResponseWithStatusCode)(NSString *, int); |
| # Download the file manually from here https://launchpad.net/gcc-arm-embedded | |
| # Note: `curl` command doesn't work | |
| # I downloaded this one: "gcc-arm-none-eabi-4_7-2013q3-20130916-mac.tar.bz2" | |
| # double click it to unzip it | |
| # Make a place to install it to | |
| mkdir /usr/local/gcc_arm | |
| # Move the unzipped stuff there. |
This template let's you easily implement a property getter like this:
- (UIView *)myView {
if (!_myView) {
_myView = [UIView new];
}
return _myView;
}