Skip to content

Instantly share code, notes, and snippets.

View asilbalaban's full-sized avatar

Asil Balaban asilbalaban

View GitHub Profile
@wildiney
wildiney / bearer-token.php
Last active February 11, 2024 18:55
[deprecated] PHP - How to get and set Bearer Token
<?php
/**
* ALERT! There are more than ten years since I wrote the first version (adaptation) of this code with PHP 5.6,
* then I changed my code stack and I couldn't mantain this code anymore. Ten years ago worked like a charm.
* Fell free to test, use, fork, update, etc. and if possible put in the comments how to fix,
* if it doesn't work for you as it is, so other people could find answers.
**/
/**
* Get hearder Authorization
@dunglas
dunglas / example.php
Created April 19, 2018 06:25
A minimalist GraphQL client for PHP
<?php
$query = <<<'GRAPHQL'
query GetUser($user: String!) {
user (login: $user) {
name
email
repositoriesContributedTo {
totalCount
}
@shaik2many
shaik2many / javascript-localstorage-expiry.js
Created July 20, 2016 14:07
set timeout for localStorage or sessionStorage
http://apassant.net/2012/01/16/timeout-for-html5-localstorage/
var hours = 24; // Reset when storage is more than 24hours
var now = new Date().getTime();
var setupTime = localStorage.getItem('setupTime');
if (setupTime == null) {
localStorage.setItem('setupTime', now)
} else {
if(now-setupTime > hours*60*60*1000) {
localStorage.clear()
@noelboss
noelboss / git-deployment.md
Last active July 16, 2024 09:50
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@asilbalaban
asilbalaban / git-ile-production.md
Last active April 23, 2017 19:08
Hergün yazılım işlerimiz için git kullanıyoruz. Ancak değişiklikleri yayına almak için hala ftp kullanıyoruz. İşleri biraz hızlandırmak için, git ile production yapmaya ne dersiniz?

#Git ile production

Hergün yazılım işlerimiz için git kullanıyoruz. Ancak değişiklikleri yayına almak için hala ftp kullanıyoruz. İşleri biraz hızlandırmak için, git ile production yapmaya ne dersiniz?

Şimdi git ile production yapmak için izlenmesi gereken yolu anlatıyorum.

Uzak sunucuda yapılması gerekenler

Öncelikle production sunucumuzda bir git dosyası oluşturuyoruz (www klasörü dışında oluşturmak mantıklı olur)

<?php
function recursive_directory($dirname,$maxdepth=10, $depth=0){
if ($depth >= $maxdepth) {
return false;
}
$subdirectories = array();
$files = array();
if (is_dir($dirname) && is_readable($dirname)) {
$d = dir($dirname);
while (false !== ($f = $d->read())) {
@stoddsie
stoddsie / gist:5336780
Last active December 15, 2015 22:59
Codeigniter:Retrieve single row from database
//Setup a database connection returning a single row value
$this->db->select("*");
$this->db->where("field", $value);
$query = $this->db->get("table",1,0);
if($query->num_rows() > 0) {
$variable = $query->row("field");
return $variable;
} else {
return FALSE;