Skip to content

Instantly share code, notes, and snippets.

View fatihsolhan's full-sized avatar
:shipit:

Fatih Solhan fatihsolhan

:shipit:
View GitHub Profile
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@aladagemre
aladagemre / sehirler.html
Created November 10, 2014 17:50
Türkiye Şehir Listesi HTML Select Option
<select name="Sehir">
<option value="0">------</option>
<option value="1">Adana</option>
<option value="2">Adıyaman</option>
<option value="3">Afyonkarahisar</option>
<option value="4">Ağrı</option>
<option value="5">Amasya</option>
<option value="6">Ankara</option>
<option value="7">Antalya</option>
<option value="8">Artvin</option>
@bradyvercher
bradyvercher / cache-post-thumbnails.php
Created January 9, 2014 17:21
WordPress: Cache post thumbnail attachments that appear in a WP_Query loop.
<?php
/**
* Plugin Name: Cache Post Thumbnails
* Description: Prime the post thumbnails cache for individual loops.
* Version: 1.0.0
* Author: Brady Vercher
* Author URI: http://www.blazersix.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@vyspiansky
vyspiansky / build-tree.php
Last active October 2, 2023 14:36
PHP: convert object / array to tree structure
<?php
/**
* The below functions take the single level array of items as an argument
* and turn it into a multidimensional array structure (tree),
* where each item has an array of sub-items.
*
* Each item should have at least an `id` and `parent_id`,
* where the `parent_id` is `0` if it's top level.
*
* Source: http://goo.gl/p2GybZ