Skip to content

Instantly share code, notes, and snippets.

@strarsis
strarsis / git-overwrite-branch.sh
Created August 15, 2024 21:12 — forked from ummahusla/git-overwrite-branch.sh
Git overwrite branch with another branch
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name
@strarsis
strarsis / Directory_Prompts_WT_Uninstall.reg
Created June 24, 2024 10:52 — forked from OmegaRogue/Directory_Prompts_WT_Uninstall.reg
Registry script to add windows terminal with cmd, powershell and ubuntu profiles to the explorer context menu with normal and admin permissions. To use, replace <Username> with your username
Windows Registry Editor Version 5.00
; Windows terminal
[-HKEY_CLASSES_ROOT\Directory\shell\MenuWindowsTerminal]
[-HKEY_CLASSES_ROOT\Directory\background\shell\MenuWindowsTerminal]
[-HKEY_CLASSES_ROOT\Directory\LibraryFolder\shell\MenuWindowsTerminal]
@strarsis
strarsis / functions.php
Created April 13, 2023 14:06 — forked from yanknudtskov/functions.php
Example on how to meta query ACF repeater fields
<?php
add_shortcode( 'user_company_link', 'yanco_user_company_link' );
function yanco_user_company_link() {
if( ! is_user_logged_in() ) {
return;
}
$html = '';
function Child({ onClick }) {
return <button onClick={onClick} type="button">Child Button</button>;
}
export default function Parent() {
const onClick = () => {
console.log('I\'m in the parent, but the child was clicked');
};
return (
@strarsis
strarsis / max_width_email.html
Created September 25, 2020 06:13 — forked from elidickinson/max_width_email.html
Email Template trick: max-width with outlook
<!--[if mso]>
<center>
<table><tr><td width="580">
<![endif]-->
<div style="max-width:580px; margin:0 auto;">
<p>This text will be centered and constrained to 580 pixels even on Outlook which does not support max-width CSS</p>
</div>
<!--[if mso]>
@strarsis
strarsis / dumprequest.php
Created April 16, 2018 15:28 — forked from magnetikonline/dumprequest.php
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
@strarsis
strarsis / dom-insert-after.php
Created March 26, 2018 22:27 — forked from deathlyfrantic/dom-insert-after.php
why doesn't the DOM spec include an insertAfter method, srsly guys
<?php
/** Inserts a new node after a given reference node. Basically it is the complement to the DOM specification's
* insertBefore() function.
* @param \DOMNode $newNode The node to be inserted.
* @param \DOMNode $referenceNode The reference node after which the new node should be inserted.
* @return \DOMNode The node that was inserted.
*/
function insertAfter(\DOMNode $newNode, \DOMNode $referenceNode)
{
if($referenceNode->nextSibling === null) {
@strarsis
strarsis / wpdb-transactions
Created March 14, 2018 20:56 — forked from nciske/wpdb-transactions
MySQL database transaction, using the WordPress database object $wpdb. Requires the InnoDB table format.
<?php
global $wpdb;
// Start Transaction
$wpdb->query( "START TRANSACTION" );
// Do some expensive/related queries here
//$wpdb->query("DELETE FROM table WHERE form_id = '1' ");
//$wpdb->query("DELETE FROM data WHERE form_id = '1' ");
// set $error variable value in error handling after $wpdb modifications
@strarsis
strarsis / gist:c900cb342140ec7d1439b35c05b1cd26
Created March 11, 2018 01:33 — forked from kuyseng/gist:2792080
javascript: indesign progress bar
function index_progress_bar(title) {
var w = new Window("palette", title, undefined);
w.orientation = "column";
var text_group = w.add("group");
text_group.orientation = "column";
var file_name = text_group.add("statictext", [0,0,350,20], "calculating..");
var remain = text_group.add("statictext", [0,0,350,20], "Remain: ..");
text_group.alignChildren = "left";
var progressbar = w.add("progressbar", undefined, 0, 100);
progressbar.preferredSize = [350,20];
@strarsis
strarsis / indd_page_extract.jsx
Created March 11, 2018 01:15 — forked from bastien/indd_page_extract.jsx
Extracting a page from an InDesign document (2 different approaches)
var doc = app.activeDocument;
if(doc.saved == true)
{
extract(2);
}
else
{
alert("Save you file.");
}