Skip to content

Instantly share code, notes, and snippets.

View vincent178's full-sized avatar
💭
Hacking

Vincent Huang vincent178

💭
Hacking
View GitHub Profile
@vincent178
vincent178 / objc-singleton.m
Created April 12, 2014 08:46
singleton in objc
+ (instancetype)sharePreference {
static TFUserPreference *sharePreference = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharePreference = [[self alloc] init];
});
return sharePreference;
}
@vincent178
vincent178 / rails-single-test.md
Created April 14, 2014 03:05
run a single rails test
rake test TEST=test/controllers/test_controller_rest.rb
@vincent178
vincent178 / sqlite3-cheat-sheet.md
Last active December 13, 2022 11:57
sqlite3 cheat sheet
@vincent178
vincent178 / declare_variable.txt
Created April 29, 2014 05:19
declare a variable in sql server
declare @rr varchar(1000)
set @rr ='variable content'
select * from A
where A.SchoolDID = @rr
select top (1000)* from B
@vincent178
vincent178 / email-regex.txt
Created April 29, 2014 05:24
email regex
/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
/                                     start of regex
\A                                   match start of a string
[\w+\-.]+                          at least one word character, plus, hyphen, or dot
@                                   literal "at sign"
[a-z\d\-.]+                        at least one letter, digit, hyphen, or dot
\.                                    literal dot
[a-z]+                              at least one letter
\z                                   match end of a string
/                                     end of regex
@vincent178
vincent178 / rails-new.txt
Created April 29, 2014 06:09
rails new using old version
rails _3.2.13_ new my_app
@vincent178
vincent178 / mysql.txt
Created May 22, 2014 06:27
mysql login and change password
login without password
mysql -uroot
login using password
mysql -uroot -p
after login, change user password
mysql> use mysql;
SET PASSWORD FOR 'user-name-here'@'hostname-name-here' = PASSWORD('new-password-here');
UPDATE mysql.user SET Password=PASSWORD('new-password-here') WHERE User='user-name-here' AND Host='host-name-here';
@vincent178
vincent178 / postgresql.md
Last active August 29, 2015 14:01
postgresql admin commands

find the largest table in the postgreSQL database

SELECT relname, relpages FROM pg_class ORDER BY relpages DESC LIMIT toprungsjobs_backup=> SELECT relname, relpages FROM pg_class ORDER BY relpages DESC LIMIT 5;

find size of the postgreSQL table

SELECT pg_size_pretty(pg_relation_size('pg_attribute'));
vdebug
• <F5>: start/run (to next breakpoint/end of script)
• <F2>: step over
• <F3>: step into
• <F4>: step out
• <F6>: stop debugging
• <F7>: detach script from debugger
• <F9>: run to cursor
1. Custom Navigation Transitions
http://captechconsulting.com/blog/tyler-tillage/ios-7-tutorial-series-custom-navigation-transitions-more
2. iOS Design Cheat Sheet
http://ivomynttinen.com/blog/the-ios-7-design-cheat-sheet/