Skip to content

Instantly share code, notes, and snippets.

@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

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-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 / 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)
{
<?php
//class FlightTree implements ArrayAccess, Traversable {
class FlightTree {
private $key;
private $data = NULL;
private $children = array();
private $parent;
@refo
refo / 0_reuse_code.js
Created September 14, 2016 21:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@refo
refo / geolocation.js
Created November 15, 2016 18:14
Javascript GeoLocation
navigator.geolocation.getCurrentPosition(function(geopos){
var coords = geopos.coords;
console.log('https://maps.google.com/?q='+coords.latitude+','+coords.longitude);
});
@refo
refo / foursquare_api_search.js
Created December 20, 2016 19:59
Foursquare Search API test
"use strict";
const
assert = require('assert'),
request = require('request'),
config = require('../config'),
_ = '';
const foursq = {