Skip to content

Instantly share code, notes, and snippets.

View yus-ham's full-sized avatar
🌴
On vacation

Yusup Hambali yus-ham

🌴
On vacation
View GitHub Profile
@stalkerg
stalkerg / Clipboard.html
Last active January 20, 2022 08:52
Svelte component for copy to clipboard.
<script>
import { tick } from 'svelte';
let valueCopy = null;
export let value = null;
let areaDom;
async function copy() {
valueCopy = value;
await tick();
@iansltx
iansltx / MultiPartFromStrings.php
Created May 2, 2015 03:31
Multipart file uploads in PHP from strings
<?php
/**
* PHP's curl extension won't let you pass in strings as multipart file upload bodies; you
* have to direct it at an existing file (either with deprecated @ syntax or the CURLFile
* type). You can use php://temp to get around this for one file, but if you want to upload
* multiple files then you've got a bit more work.
*
* This function manually constructs the multipart request body from strings and injects it
* into the supplied curl handle, with no need to touch the file system.