Skip to content

Instantly share code, notes, and snippets.

@MyBigFish
MyBigFish / nginx.conf
Created May 14, 2018 08:31 — forked from ashleydw/nginx.conf
Laravel nginx conf file
server {
listen 80 default_server;
server_name example.com www.example.com;
access_log /srv/www/example.com/logs/access.log;
error_log /srv/www/example.com/logs/error.log;
root /srv/www/example.com/public;
index index.php index.html;
@MyBigFish
MyBigFish / gist:c2baa89bb39d4472da7827b57e634606
Created July 18, 2017 09:33 — forked from nl5887/gist:f88ca64b67f7dce3690c
Dynamically returns a zip file consisting of multiple Amazon S3 objects
// download zipfile
func ZipHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
token := vars["token"]
db, err := sql.Open("mysql", config.DSN)
if err != nil {
panic(err.Error()) // Just for example purpose. You should use proper error handling instead of panic
}
@MyBigFish
MyBigFish / KeyboardHandler.m
Created August 18, 2016 09:57 — forked from philipmcdermott/KeyboardHandler.m
Getting the keyboard height on iOS.
- (void)viewDidAppear:(BOOL) animated {
[super viewDidAppear:animated];
// Register notification when the keyboard will be show
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
// Register notification when the keyboard will be hide
[[NSNotificationCenter defaultCenter] addObserver:self
// NOTE: This delegate method requires you to disable UICollectionView's `pagingEnabled` property.
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint *)targetContentOffset {
CGPoint point = *targetContentOffset;
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout;
// This assumes that the values of `layout.sectionInset.left` and