Skip to content

Instantly share code, notes, and snippets.

View userabuser's full-sized avatar
💭
What's good?

userabuser

💭
What's good?
View GitHub Profile
@mphuie
mphuie / index.html
Last active November 10, 2023 14:42
pyqt webview javascript -> python example
<html>
<head>
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<style>
::selection {
background:transparent;
}
</style>
</head>
@timacdonald
timacdonald / ContactIndexResponse.php
Last active February 9, 2023 21:48
Easily respond to content types and url extensions
<?php
namespace App\Http\Responses;
use App\Models\ContactType;
use App\Factories\CsvFactory;
class ContactIndexResponse extends Response
{
public function __construct($contacts)
@GeekPress
GeekPress / cache-woo-get-refreshed-fragment-request.php
Last active July 25, 2019 09:58
Cache WooCommerce Get Refreshed Fragment Request
<?php
if ( isset( $_GET['wc-ajax'] ) && 'get_refreshed_fragments' === $_GET['wc-ajax'] && ( !isset( $_COOKIE['woocommerce_cart_hash'] ) || empty( $_COOKIE['woocommerce_cart_hash'] ) ) && ( !isset( $_COOKIE['woocommerce_items_in_cart'] ) || empty( $_COOKIE['woocommerce_items_in_cart'] ) ) ) {
$data = get_transient( 'rocket_get_refreshed_fragments_cache' );
if ( ! empty( $data ) ) {
$data = json_decode( $data );
wp_send_json( $data );
}
ob_start();
// originaly from https://kb.apify.com/tips-and-tricks/scraping-data-from-websites-using-schemaorg-microdata
function schemaOrgParser() {
var extractValue = function(elem) {
return $(elem).attr("content") || $(elem).text()
|| $(elem).attr("src") || $(elem).attr("href") || null;
};
var addProperty = function(item,propName,value) {
if( typeof(value)==='string' )
value = value.trim();
if( Array.isArray(item[propName]) )
@Cerothen
Cerothen / AdvancedWindowSnap.ahk
Last active April 2, 2022 03:36 — forked from AWMooreCO/AdvancedWindowSnap.ahk
Advanced Window Snap is a script for AutoHotKey that expands upon Windows built-in window-snapping hotkeys.
/**
* Advanced Window Snap (Extended
* Snaps the Active Window to one of nine different window positions.
*
* @Editing author Jarrett Urech
* @Original author Andrew Moore <andrew+github@awmoore.com>
* @version 2.1
*
**/
@larsonmars
larsonmars / w2lp.c
Last active February 16, 2019 16:25
WSL windows to linux path converter
/* w2lp.c
*
* 2017 by Lars Stockmann
* released in the public domain
*/
#include <stdio.h>
#define PRE_PATH "/mnt/"
@jessfraz
jessfraz / boxstarter.ps1
Last active April 11, 2024 16:02
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@maxivak
maxivak / __upload_file.md
Last active April 4, 2024 10:07
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");
@jwilson8767
jwilson8767 / install_WSL_docker.sh
Last active May 14, 2020 17:17
Docker Toolbox for Windows and Windows Subsystem for Linux (aka Bash on Windows)
#
# This script installs and configures WSL to work with Docker Toolbox for Windows.
# 1. Install WSL (check out [bowinstaller](https://github.com/xezpeleta/bowinstaller) for programmatic installation.
# 2. Run the contents of this script in Bash. (copy and paste works fine, no need to save)
#
sudo -sEH << 'EOM'
# Install the docker client and docker-compose
apt-get update && apt-get install -y curl ca-certificates
curl -sSL https://get.docker.com/ | sh
curl -L "https://github.com/docker/compose/releases/download/1.11.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
@strarsis
strarsis / docker-on-wsl-windows-10-home-docker-toolbox.md
Last active September 4, 2023 07:29
Notes about Docker on WSL (Windows 10 Home / Docker Toolbox) (Virtualbox instead Hyper-V)

Edit (September 2020):