Skip to content

Instantly share code, notes, and snippets.

View kostajh's full-sized avatar

Kosta Harlan kostajh

View GitHub Profile
@dangle
dangle / Obsidian Todoist Script.md
Last active February 7, 2024 20:11
Script for use with Obsidian to pull in a snapshot of a day from Todoist

Obsidian Todoist Script

Description

This takes a day in YYYY-MM-DD format and can be called using the CustomJS plugin with either the Dataview plugin or the Templater plugin.

Styling

In order to get nicer styling, copy the todoist.css file to .obsidian/snippets and enable it under Settings → Appearance.

import path from 'path';
import fs from 'fs';
import { generate } from 'astring'
interface Options {
test: RegExp;
include: string[];
dir: string;
}
@black-silence
black-silence / sonarphp-xml-patcher.py
Created April 10, 2019 13:49
quick-dirty phpunit xml result patcher so sonarphp doesn't choke
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
et = ET.parse('logfile.xml')
root = et.getroot()
for mastersuites in root:
for suite in mastersuites:
if not "file" in suite.attrib:
continue
@egardner
egardner / Dockerfile
Last active January 28, 2021 17:39
Basic MW dev environment with Docker
# Put this in web/Dockerfile
# Adapted from https://github.com/wikimedia/mediawiki-docker/blob/master/1.32/Dockerfile
FROM php:7.2-apache
# System Dependencies.
RUN apt-get update && apt-get install -y \
git \
imagemagick \
libicu-dev \
function THEMENAME_theme_suggestions_block_alter(array &$suggestions, array $variables) {
if (isset($variables['elements']['content']['#block_content'])) {
$suggestions[] = 'block__' . $variables['elements']['content']['#block_content']->bundle();
}
}
@jehaby
jehaby / README.md
Last active January 25, 2024 14:43 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
<?php
class DrupalHubFlagLike extends \RestfulEntityBase {
/**
* {@inheritdoc}
*/
public function publicFieldsInfo() {
$public_fields = parent::publicFieldsInfo();
@hawkeyetwolf
hawkeyetwolf / drush-alias-remote-host-check.php
Last active April 4, 2016 22:16
Drush aliases: scrub "remote host" key for cross-environment use
<?php
/**
* @file
* Example drush alias file for multihost use.
*/
// Alias settings common to all.
$aliases['base'] = array(
'root' => '/var/www/docroot',
@jhedstrom
jhedstrom / FeatureContext.php
Last active June 24, 2021 12:55
Using the Behat Drupal Extension on sites with basic auth
<?php
/**
* Run before every scenario.
*
* @BeforeScenario
*/
public function beforeScenario() {
if ($basic_auth = $this->getDrupalParameter('basic_auth')) {
$driver = $this->getSession()->getDriver();
if ($driver instanceof Selenium2Driver) {
@mikeyp
mikeyp / search.sh
Last active September 16, 2016 16:07
BOOM
ag "$@" | peco | awk -F ':' '{print $1 ":" $2}' | xargs pstorm