Skip to content

Instantly share code, notes, and snippets.

View asdfMaciej's full-sized avatar
👀

Maciej Kaszkowiak asdfMaciej

👀
View GitHub Profile
<?php
declare(strict_types=1);
namespace Infrastructure\Symfony\Mime;
use Symfony\Component\Mime\FileBinaryMimeTypeGuesser;
use Symfony\Component\Mime\MimeTypeGuesserInterface;
/**
@subhadarship
subhadarship / net_using_pytorch.py
Last active May 10, 2024 08:59
simple neural net using pytorch
import torch
from torch import nn
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm
import matplotlib.pyplot as plt
class MyDataset(Dataset):
def __init__(self):
@cyberwani
cyberwani / wordpress-upload-base64.php
Created September 13, 2019 10:19
Upload a base64 string as image to the WordPress media library
<?php
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;
@blivic
blivic / mx-woo-bacs-instructions-order-number.php
Last active January 12, 2023 09:43
WooCommerce - better BACS payment instructions
<?php
/*
Plugin Name: MX Woo BACS
Plugin URI: https://media-x.hr
Description: Poboljšane upute za plaćanje putem direktne bankovne transakcije
Version: 1.0
Author: Media X
WC requires at least: 3.0
WC tested up to: 3.6.4
Author URI: http://media-x.hr
@axelvnk
axelvnk / OrSearchFilter.php
Last active June 9, 2024 15:20
Api platform OR search filter
<?php
namespace Axelvkn\AppBundle\Filter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
use ApiPlatform\Core\Exception\InvalidArgumentException;
use Doctrine\ORM\QueryBuilder;
class OrSearchFilter extends SearchFilter
@kolisn
kolisn / set.py
Last active September 21, 2022 04:00
JSON tool for pogo spawnscan
import urllib2
import sqlite3
import pip
import os
import json
import pymysql.cursors
#inFile: SQL databse filename string (assuming .db) #outFile: JSON filename string
def getDataFromDBFile(inFile, outFile):
try:
conn=sqlite3.connect(inFile)
@aras-p
aras-p / preprocessor_fun.h
Last active June 21, 2024 12:20
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,