Skip to content

Instantly share code, notes, and snippets.

@refo
refo / ykb.php
Created February 25, 2015 08:01
<?php
/*
Refik ÖNAL
refikonal@gmail.com
20130308.0144
referans dosyalar:
classes/controller/page.php : action_siparis_kayit() - Yusuf Güzel
views/static/3d-test.php
@refo
refo / nginx-install-ssl.md
Last active August 29, 2015 14:17
LEMP stack sunucuda SSL sertifikası install etme

Key ve Certificate Signing Request oluştur

openssl req -newkey rsa:2048 -nodes -keyout generatour.com.key -out generatour.com.csr

CSR ile sertifika satın aldıktan sonra, sertifika ile Intermediate CA Certificate dosyalarını birleştirerek bundle oluştur

cat generatour_com.crt COMODORSADomainValidationSecureServerCA.crt > generatour.com.chained.crt
@refo
refo / laravel-master-vendor-fix.md
Last active August 29, 2015 14:17
Laravel 5'i, kendi `vendor` klasörüne bağlı kalmadan çalıştır

Dış tabaka klasör yapısı

.
|-- public
|   |-- index.php       // ../src/boot.php'yi çağırır
`-- src
    |-- boot.php        // Laravel uygulamasını boot eder
    |-- composer.json
    |-- composer.lock
    |-- laravel         // laravel/laravel repo'sundan indirilen uygulama
@refo
refo / remove-leading-slash
Created June 5, 2015 13:27
javascript - Remove leading slashes
'/example/string/'.replace(/^\/+/g, '');
// Should remove all leading slashes and return 'example/string/'

Ignore Platform Requirements

Bypass PHP version, extension requirement, etc.

When trying to install "laravel/framework" : "~5.0" (which is currently Laravel 5.1.*) on a GoDaddy server, i keep ended up installing Laravel 5.0.* because while Godaddy supports PHP-CGI 5.5, they only support PHP-CLI 5.4.* on my server and composer is not working using PHP-CGI. To bypass requirements check on an enviroment where you sure requirements are already met, use composer with the following switch.

composer install --ignore-platform-reqs
@refo
refo / git-deploy-checkout.md
Last active January 9, 2018 12:22
Deploy website using git checkout

Deploy website using git checkout

Remote Shell

Create a base directory

I'm stacking all files in a single directory for all development phases

cd /home/user/website.com/
@refo
refo / git-version-info-hooks.md
Last active August 29, 2015 14:26
Git version and revision information hooks

Write current version and revision to file

Uses this example format: v2.1.102 (13a02b0) where

  • v2.1 is last tag
  • 102is the number of commits made
  • 13a02b0 is the shortened hash of the last commit

If repo is not tagged, v0 will be used as default.

Local git repo

Write version info to VERSION file in the repo root

@refo
refo / laravel5-snippets.md
Last active August 29, 2015 14:27
Laravel 5 Snippets

Run sql dumps or exports

DB::unprepared(file_get_contents('/path/to/dump.sql'));

Query builder where clause operators

Defined in Illuminate/Database/Query/Builder.php

@refo
refo / adb-ss.sh
Last active January 31, 2019 23:27
Take an android screenshot to desktop
# OS X default screen shot date format
# e.g. "2015-08-28 at 18.45.05"
DATE=`date +"%F at %H.%M.%S"`
# OS X default screen shot file name
# e.g. "Screen Shot 2015-08-28 at 18.45.05.png"
FILE=~/Desktop/Screen\ Shot\ $DATE.png
# Path to genymotion adb
ADB="/usr/bin/env adb"
@refo
refo / obfuscate.php
Last active October 8, 2015 22:20
Obfuscate string to prevent scraping / harvesting (e.g. e-mail addresses)
<?php
// -------------------------------------------------
// Kohana 3.0'dan alıntı
// HTML::obfuscate
// -------------------------------------------------
function obfuscate($string)
{
$safe = '';
foreach (str_split($string) as $letter)
{