Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Mathis Wiehl fahrradflucht

🦀
View GitHub Profile
@fahrradflucht
fahrradflucht / filters.php
Last active Mar 6, 2021
Add the "missing" `item_class`, `item_link_class` and `current_item_link_class` arguments to `wp_nav_menu`.
View filters.php
<?php
/**
* Adds support for passing `item_class` to `wp_nav_menu`.
*/
add_filter('nav_menu_css_class', function ($class_names, $item, $args) {
if (property_exists($args, 'item_class')) {
return array_merge($class_names, explode(' ', $args->item_class));
}
View function-type.ts
type ArgumentsType<T> = T extends (...args: infer A) => unknown ? A : never;
const add = (a: number, b: number): number => a + b
type Add = typeof add;
function logAdd(...args: ArgumentsType<Add>): ReturnType<Add> {
const [a, b] = args;
const result = add(a, b)
console.log(a, b, result)
View sf_login.ts
import * as crypto from "crypto";
import fetch, { Headers } from "node-fetch";
import { promisify } from "util";
const pbkdf2 = promisify(crypto.pbkdf2);
const endpoint = "https://sync.standardnotes.org";
const email = process.env.SN_EMAIL || "";
const uip = process.env.SN_PASSWORD || "";
View editor.rs
extern crate tempfile;
use self::tempfile::NamedTempFile;
use std::error::Error;
use std::ffi::OsString;
use std::io::prelude::*;
use std::process::Command;
pub fn edit_string(s: &str) -> Result<String, Box<Error>> {
let mut file = NamedTempFile::new()?;
@fahrradflucht
fahrradflucht / output.log
Created Aug 6, 2016
airmozilla docker-compose up fail
View output.log
Step 12 : RUN pip install -r requirements.txt
---> Running in d61643e62635
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 262, in run
for req in parse_requirements(filename, finder=finder, options=options, session=sessi
on):
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1632, in parse_requirements
View keybase.md

Keybase proof

I hereby claim:

  • I am fahrradflucht on github.
  • I am mathiswiehl (https://keybase.io/mathiswiehl) on keybase.
  • I have a public key ASCxsPtrbKLhn7IAVS7LhMTniXQ9D2qzZeBlYtHwg8akhgo

To claim this, I am signing this object:

View contact_model.rb
class Contact < ApplicationRecord
before_save :update_status_notifications
#...
def update_status_notifications
# Clear notifications
unless status_notification_ids.empty?
status_notification_ids.each do |id|
UserMailer.dequeue_status_notification(id)