This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar attachment-folder "~/Desktop/") | |
(defvar compose-buffer nil) | |
(with-eval-after-load 'mu4e | |
(define-key mu4e-compose-mode-map (kbd "C-c C-a") 'lt/mml-attach-file)) | |
(with-eval-after-load 'dired | |
(define-key dired-mode-map (kbd "E") 'lt/process-marked-files-as-attachments)) | |
(defun lt/mml-attach-file () | |
"Opens a Dired buffer to select attachments. The keybinding to send these back to the email draft is E." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Sorter { | |
public function __construct(private array $array) {} | |
/** | |
* Sort the array by a specific key in ascending or descending order. | |
* | |
* @param string $key The key to sort by. | |
* @param string $order The order direction, 'asc' for ascending or 'desc' for descending. Default is 'asc'. | |
* @return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// php can't write directly to a non-regular-file due to the php filesystem | |
// abstraction in place. But, we can use direct calls to the low level standard | |
// library to achieve this. | |
// normally, you should use the dio extension: | |
// - https://pecl.php.net/package/dio | |
// - https://github.com/php/pecl-system-dio/tree/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# goes in lib/your_app_web/controllers/error_html.ex | |
defmodule ExampleWeb.ErrorHTML do | |
use ExampleWeb, :html | |
def render("404.html" = template, assigns) do | |
assigns = | |
assigns | |
|> Map.merge(%{__changed__: %{}}) | |
|> assign(:message, Phoenix.Controller.status_message_from_template(template)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// code updates are now there: | |
// https://github.com/Bleuje/processing-animations-code/blob/main/code/fractalsliding2d/fractalsliding2d.pde | |
// Processing code by Etienne JACOB | |
// for collab with Yann Le Gall (https://demozoo.org/graphics/322553/) | |
// motion blur template by beesandbombs | |
// See the license information at the end of this file. | |
// View the rendered result at: https://bleuje.com/gifanimationsite/single/2dfractalslidingsquares/ | |
// using double instead of float makes the code a bit more complicated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule TravelerWeb.SearchbarLive do | |
use TravelerWeb, :live_view | |
alias Phoenix.LiveView.JS | |
alias Traveler.Places | |
def mount(_params, _session, socket) do | |
socket = assign(socket, places: []) | |
{:ok, socket, layout: false} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-org-make-link () | |
"Turn selected text into an Org mode link by replacing the selected | |
text with a link that uses the selected text as the link description | |
and the clipboard contents as the link URL." | |
(interactive) | |
(let ((link-description (if (use-region-p) | |
(buffer-substring-no-properties (region-beginning) (region-end)) | |
(read-string "Link description: "))) | |
(clipboard-contents (current-kill 0))) | |
(delete-region (region-beginning) (region-end)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.Integrations.Skubana do | |
@host "..." | |
@headers [ ... ] | |
# returns a stream of shipments | |
def get_shipments do | |
# start with page 1 | |
start = fn -> 1 end | |
# create a stream, it will make HTTP requests until the page returned is empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Integration; | |
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; | |
use Symfony\Component\HttpKernel\HttpKernelInterface; | |
use Symfony\Component\Routing\RouterInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with recursive | |
dims (r1, r2, i1, i2, s, it, p) as (values (-2::float, 1::float, -1.5::float, 1.5::float, 0.01::float, 100, 256.0::float)), | |
sprites (s) as (values (st_makepolygon(st_geomfromtext('linestring (0 0, 0 1, 1 1, 1 0, 0 0)')))), | |
n1 (r, i) as (select r, i from dims, generate_series((r1 / s)::int, (r2 / s)::int) r, generate_series((i1 / s)::int, (i2 / s)::int) i), | |
n2 (r, i) as (select r::float * s::float, i::float * s::float from dims, n1), | |
l (cr, ci, zr, zi, g, it, p) as ( | |
select r, i, 0::float, 0::float, 0, it, p from n2, dims | |
union all | |
select cr, ci, zr*zr - zi*zi + cr, 2 * zr * zi + ci, g + 1, it, p from l where g < it and zr*zr + zi*zi < p | |
), |
NewerOlder