Skip to content

Instantly share code, notes, and snippets.

View borantula's full-sized avatar

Bora Yalcin borantula

View GitHub Profile
@borantula
borantula / gist:6f8284e0c1c20135cb9522a6a11d2f14
Created February 21, 2020 16:32
Prevent commit to master pre commit hook
///~/projects/xxx/.git/hooks $ cat pre-commit
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then
echo "You can't commit directly to master branch"
exit 1
fi
@borantula
borantula / translation_keys_import_from_csv.js
Last active May 7, 2020 09:43
translation keys importer
/*
const data = [
{
"EN": "e.g. Art, Coins, Jewellery, Antiques, Cars",
"NL": "bijv. kunst, munten, sieraden, antiek, auto's",
"DE": "z.B. Kunst, Münzen, Schmuck, Antiquitäten, Autos",
"FR": "par exemple art, monnaies, bijoux, antiquités, voitures",
"IT": "per es. Arte, Monete, Gioielli, Antiquariato, Auto",
"ES": "por ejemplo, arte, monedas, joyería, antigüedades, coches",
"PT": "e.g. arte, moedas, jóias, antiguidades, carros",
@borantula
borantula / test-cli
Created August 9, 2019 11:48
run test with pattern
yarn run test --testPathPattern="screens" --watch
@borantula
borantula / gist:85893a616f0b79d7254e87d47d6abfcf
Created April 3, 2019 14:52
Splitting a huge PR by unstaging files
git reset --soft last-commit-before-branch
then unstage all files changed and add as you wish create new commits etc.
@borantula
borantula / upgradenode.bash
Created July 5, 2018 14:16
How to upgrade Node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@borantula
borantula / gist:fd3497a6e7092bdef0f594cd8445aa23
Created July 4, 2018 07:54
Run command pm2 from other user as root
sudo runuser -l root -c 'pm2 restart myapp'
//https://www.facebook.com/ads/preferences/?entry_product=ad_settings_screen
//Put this in console and watch :)
clear();
document.querySelector('#u_0_t ._2qo2 ._2qo6').click();
setTimeout(()=>{
var seeMoreInterval = setInterval(()=>{
if(document.querySelector('._45yr')) {
document.querySelector('._45yr').click()
} else {
@borantula
borantula / gist:f87f6a6c96318a5544e29ebd4f27b7ff
Created December 4, 2017 21:47
Renewing letsencrypt without certbot
service nginx stop;sudo -H /opt/letsencrypt/letsencrypt-auto renew;service nginx start
@borantula
borantula / importfromgzip.sh
Created November 27, 2017 10:47
Import gzip from console
#I keep forgetting this!
zcat myfile.sql.gz | mysql -u root -ppassword mydbname
@borantula
borantula / cakephp-i18n-migration.php
Created February 13, 2017 10:47
CakePHP I18N Table Migration
<?php
use Migrations\AbstractMigration;
class ArticlesI18n extends AbstractMigration
{
/**
* Change Method.
*
* More information on this method is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-change-method