Skip to content

Instantly share code, notes, and snippets.

View 0xKayvan's full-sized avatar
💻
In code we trust.

Kayvan Nouri 0xKayvan

💻
In code we trust.
  • Mordor
View GitHub Profile
@0xKayvan
0xKayvan / gist:7577d4206b983251b13a
Created April 13, 2015 09:00
hide empty cells at the bottom of UITableView
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
@0xKayvan
0xKayvan / gist:121df87fce9485ac4698
Created April 15, 2015 21:55
address of gitlab conf
/etc/gitlab/gitlab.rb
@0xKayvan
0xKayvan / gist:827d130de6a9c89b8345
Created April 24, 2015 16:06
uiTextView placeholder trick
-(void) viewDidLoad{
[textView setDelegate:self];
}
-(void) textViewDidBeginEditing:(UITextView *)textView{
if ([textView.text isEqualToString:@"placeholder text here..."]) {
textView.text = @"";
textView.textColor = [UIColor blackColor]; //optional
}
[textView becomeFirstResponder];
@0xKayvan
0xKayvan / showPHPErrors.php
Last active November 12, 2015 20:39
show php error in brower
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);
@0xKayvan
0xKayvan / gitlab-reenable-signin.sh
Last active January 3, 2024 20:56
enable gitlab sign-in after accidentally disable it in admin
sudo gitlab-rails console
ApplicationSetting.last.update_attributes(signin_enabled: true)
exit
sudo gitlab-ctl restart
@0xKayvan
0xKayvan / reloadData.m
Created November 12, 2015 20:38
reloadData so the device rotation would be more smooth
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if (size.width > size.height) {
[self.tableView reloadData];
}
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if (size.width < size.height) {
[self.tableView reloadData];
}
@0xKayvan
0xKayvan / gist:fbf8b8f8f108916082a6628bc71bccd8
Created February 22, 2017 06:00
remove all docker containers and images
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
var Promise = require('bluebird');
doTask1()
.then(doTask2)
.then(doARecursiveTask)
.then(doFinalTask)
.then(function (fullfilled) {
console.log('that last thing is:', fullfilled)
console.log('[DOOOOOOOOONEEEE]')
})
#!/bin/sh
DIR=`date +%Y-%m-%d-%H-%M-%S`
DEST=/root/db_backups/$DIR
mkdir $DEST
mongodump -o $DEST
scp -r /root/db_backups/$DIR 7030backup:/root/mongodb_backups/$DIR
@0xKayvan
0xKayvan / folder-structure.txt
Last active October 29, 2020 19:18
folder structure
- ChatApplication
|- Documents
|- Doucumentations
|- Resources
|- Sources
|- backend
|- iOS