Skip to content

Instantly share code, notes, and snippets.

View Hasokeyk's full-sized avatar
🏠
Working from home

Hasan Yüksektepe Hasokeyk

🏠
Working from home
View GitHub Profile
@berkocan
berkocan / Altın Fiyatları (Api) Json Kodu.php
Last active January 30, 2024 10:21
Altın Fiyatları (Api) Json Kodu, Sitene Altın Fiyatları Ekle | Gram, Çeyrek Altın (Api) Json
Altın fiyatlarını json ile api olarak sitenize eklemek için aşağıdaki kodları kullanabilirsiniz. ▼☟↓
<?php
$JSON = json_decode(file_get_contents('https://api.genelpara.com/embed/altin.json'), true);
?>
<ul>
<li>
<span>Gram Altın</span>
<span>Fiyat: <?php echo $JSON['GA']['satis']; ?></span>
<span>Değişim: <?php echo $JSON['GA']['degisim']; ?></span>
@trey8611
trey8611 / wc-get-total-order-weight.php
Last active April 25, 2022 07:00
WooCommerce Orders - Get total order weight in WP All Export
<?php
function my_get_total_order_weight( $order_id ) {
$order = wc_get_order( $order_id );
$order_items = $order->get_items();
$total_qty = 0;
$total_weight = 0;
foreach ( $order_items as $item_id => $product_item ) {
$product = $product_item->get_product();
if ( ! $product ) continue;
@2ec0b4
2ec0b4 / listener.php
Created December 13, 2019 10:38
PostgreSQL Notifier with a PHP Listener
<?php
set_time_limit(0);
$db = new PDO(
'pgsql:dbname=dbname host=host port=5432;options=--application_name=APPLICATION_NAME',
'user',
'password',
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
@pavankjadda
pavankjadda / How to fix gitignore not working issue.md
Last active June 20, 2024 15:28
How to fix "gitignore not working" issue

FYI: Created blog post with more details

How to fix ".gitignore not working" issue?

Sometimes git does not exclude files/folders added .gitignore especially if you had commited them before. Here is how to fix it. I am ignoring node_modules from Angular project as an example

  1. Update .gitignore with the folder/file name you want to ignore. You can use anyone of the formats mentioned below (prefer format1)
### Format1  ###
node_modules/
@hagino3000
hagino3000 / client.js
Created December 8, 2011 18:42
WebSocket with binary data
var socket = null;
function bootstrap() {
// 適当な図形を描画
var c = document.getElementById('mycanvas');
var ctx = c.getContext('2d');
ctx.globalalpha = 0.3;
for(var i=0; i<1000; i++) {
ctx.beginPath();