Skip to content

Instantly share code, notes, and snippets.

View serefercelik's full-sized avatar

Şeref Erçelik serefercelik

View GitHub Profile
public function up()
{
Schema::create('tags', function($table){
$table->increments('id');
$table->string('name')->unique();
});
$sql = <<<SQL
DROP PROCEDURE IF EXISTS sp_insert_tag;
CREATE PROCEDURE sp_insert_tag(IN _name VARCHAR(32))
BEGIN
Text("Hello, World!").padding(EdgeInsets(top: 500, leading: 0, bottom: 0, trailing: 0))
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
if (firebaseUser != null) {
for (UserInfo userInfo : firebaseUser.getProviderData()) {
if (userInfo.getProviderId().equals("google.com")) {
Log.d(TAG, "User is signed in with Google");
} else if(userInfo.getProviderId().equals("facebook.com")) {
Log.d(TAG, "User is signed in with Facebook");
}
}
}
@serefercelik
serefercelik / momentjs
Created June 9, 2020 10:49
moment.js from now
let timing = new Date(date*1000);
//let timing = moment(date).format('MMMM Do YYYY, h:mm:ss a');
//console.log(moment(timing).year());
var start = moment(timing);
var end = moment();
var duration = moment.duration(end.diff(start));
var mins = duration.asMinutes(); // give mins
console.log(start.from(end)); // "a day ago"
// Before returning the database configuration, place read hosts into an array.
$readHosts = ['193.168.1.1', '194.168.1.1'];
//
'mysql' => array(
'read' => array(
// Return a random host
'host' => $readHosts[array_rand($readHosts)],
),
@serefercelik
serefercelik / yokVT.sql
Created November 29, 2018 11:19 — forked from hkulekci/yokVT.sql
üniversite - fakülte - bölüm
CREATE TABLE `yok_bolumler` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`fakulteId` varchar(40) NOT NULL,
`universiteId` int(6) NOT NULL,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `fakulteHash` (`fakulteId`)
) ENGINE=MyISAM;
INSERT INTO `yok_bolumler` (`id`, `fakulteId`, `universiteId`, `name`) VALUES
@serefercelik
serefercelik / countries.sql
Created May 9, 2018 16:01 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@serefercelik
serefercelik / fail2ban.md
Created April 2, 2018 00:20 — forked from joecampo/fail2ban.md
fail2ban – stop HTTP(S) route abuse/brute forcing

If you're not familiar: What is fail2ban? fail2ban is an awesome linux service/monitor that scans log files (e.g. auth.log for SSH) for potentially malicious behavior. Once fail2ban is tripped it will ban users for a specified duration by adding rules to Iptables. If you're unfamiliar with fail2ban Chris Fidao has a wonderful (& free!) series about security including setting up fail2ban here.

Recently Laravel released a new feature in 5.1 to throttle authentication attempts by simply adding a trait to your authentication controller. The Laravel throttle trait uses the inputted username, and IP address to throttle attempts. I love seeing this added to a framework out of the box, but what about some of our other apps not built on Laravel? Like a WordPress login? Or even an open API etc.? Ultimately,

@serefercelik
serefercelik / tr_countries.sql
Created April 21, 2016 10:44 — forked from yahyaerturan/tr_countries.sql
Türkçe Ülkeler MySQL Tablosu
CREATE TABLE IF NOT EXISTS `countries_list` (
`id_country` tinyint(3) unsigned NOT NULL auto_increment,
`country_name` varchar(30) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id_country`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=207 ;
--
-- Dumping data for table `countries_list`
--
/*
* İl : 81
* İlçe : 957
*
* */
var city = new Array('Adana', 'Adıyaman', 'Afyonkarahisar', 'Ağrı', 'Amasya', 'Ankara', 'Antalya', 'Artvin', 'Aydın', 'Balıkesir', 'Bilecik', 'Bingöl', 'Bitlis', 'Bolu', 'Burdur', 'Bursa', 'Çanakkale', 'Çankırı', 'Çorum', 'Denizli', 'Diyarbakır', 'Edirne', 'Elazığ', 'Erzincan', 'Erzurum', 'Eskişehir', 'Gaziantep', 'Giresun', 'Gümüşhane', 'Hakkâri', 'Hatay', 'Isparta', 'Mersin', 'İstanbul', 'İzmir', 'Kars', 'Kastamonu', 'Kayseri', 'Kırklareli', 'Kırşehir', 'Kocaeli', 'Konya', 'Kütahya', 'Malatya', 'Manisa', 'Kahramanmaraş', 'Mardin', 'Muğla', 'Muş', 'Nevşehir', 'Niğde', 'Ordu', 'Rize', 'Sakarya', 'Samsun', 'Siirt', 'Sinop', 'Sivas', 'Tekirdağ', 'Tokat', 'Trabzon', 'Tunceli', 'Şanlıurfa', 'Uşak', 'Van', 'Yozgat', 'Zonguldak', 'Aksaray', 'Bayburt', 'Karaman', 'Kırıkkale', 'Batman', 'Şırnak', 'Bartın', 'Ardahan', 'Iğdır', 'Yalova', 'Karabük', 'Kilis', 'Osmaniye', 'Düzce');
var phone_code = new Array('0322', '0416', '0272', '0472', '0358', '0312', '0242', '0