Skip to content

Instantly share code, notes, and snippets.

View younthu's full-sized avatar

Andrew Yang younthu

View GitHub Profile
@younthu
younthu / iphone5screenAdaption
Created September 23, 2014 05:27
解决iphone 5上下黑边的问题
如果你不幸遇到iphone5上下黑边的问题,别慌。
随便搞一张640 × 1136的图片,命名为Default-568h@2x.png, 拖到工程里面去,不需要在任何地方用它,然后黑边问题就会消失了。
640x1136刚好是iphone的屏幕分辨率。可能是系统自动识别这种图片尺寸,然后自适配iphone5的屏幕了吧。
@younthu
younthu / gist:eb062fe9194d69b2ab0f
Created September 24, 2014 02:38
Access denied for user 'root'@'localhost' (using password: NO)
wamp 出现这个问题,解决办法:
打开工程的config.inc.php, 把密码置为空。
@younthu
younthu / darkmagicfordebugginsiosapp
Created September 30, 2014 03:07
dark magic for debugging ios app
https://medium.com/ios-apprentice/dark-magic-for-debugging-your-ios-app-bc76f237be21
@younthu
younthu / dos2unix
Last active August 29, 2015 14:07
dos to unix break line
可以用dos2unix 工具做dos 2 unix 格式转换。
dos2unix可以用brew安装.
更多dos 2 unix 格式转换请参考
http://www.cyberciti.biz/faq/howto-unix-linux-convert-dos-newlines-cr-lf-unix-text-format/
note:
dos2unix貌似不工作,没有仔细研究为何。最后用TextMate做格式转换解决了这个问题。TextMate->Text->Reformat可以帮忙去除windows换行符,然后用vim做下处理,添加换行符就可以了。
@younthu
younthu / AttributtedStringTextColor
Created October 7, 2014 02:50
Text color for attributtedString
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:text];
[attrString addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(0, @"yyyy年MM月dd日".length)];
@younthu
younthu / 删除空行
Created October 10, 2014 06:28
VIM 专题
//下面的命令可以用来删除空行
:g/^$/d
var githubList = [
{
name:'系统基础库',
list: [
{name:'Category/Util',
list: [
{name:'sstoolkit', owner:'soffes', desc:'一套Category类型的库,附带很多自定义控件 功能不错~'},
{name:'BlocksKit', owner:'pandamonia', desc:'将Block风格带入UIKit和Founcation'},
{name:'cocoa-helpers', owner:'enormego', desc:'一些Cocoa的扩展 2年前的工程'},
#import <AppKit/AppKit.h>
@interface NSImage (DrawAttributedString)
+ (NSImage *)imageWithAttributedString:(NSAttributedString *)attributedString
backgroundColor:(NSColor *)backgroundColor;
+ (NSImage *)imageWithAttributedString:(NSAttributedString *)attributedString;
+ (NSImage *)imageWithString:(NSString *)string;
@end
@younthu
younthu / gist:7d01bfad6a51f04464e1
Created January 9, 2015 02:17
个人常用Mac 软件
TextMate,
vim,
xvim,
Spectacle
SimHolders
Alfred
iFunBox
The unarchiver
evernote
CoreDataEditor
@younthu
younthu / gist:37eccfa17dc019853cc00a2a89222d64
Created March 19, 2019 02:50
ransack search ActsAsTaggableOn
Model:
class People < ActiveRecord
acts_as_taggable_on :genders,:features
end
index.html.erb
<%= search_form_for @q do |f| %>
<%= f.search_field :features_name_cont, class: "form-control", placeholder:type here" %>