Skip to content

Instantly share code, notes, and snippets.

View wp-freund's full-sized avatar

wp-freund

View GitHub Profile
extension Stylesheet {
static func applyOn(cell: CountdownListCell) {
typealias context = Stylesheet.Contexts.CountdownListCell
cell.backgroundColor = context.BackgroundColor
cell.contentView.backgroundColor = context.BackgroundColor
cell.titleLabel.textColor = context.TitleTextColor
cell.titleLabel.font = UIFont(name: Fonts.Regular, size: 24.0)
}
enum Stylesheet {
enum Colors {
static let White = UIColor(hex: "#FFFFFF")
static let Black = UIColor(hex: "#262626")
static let DarkGray = UIColor(hex: "#333333")
static let LightGray = UIColor(hex: "#787878")
static let Blue = UIColor(hex: "#7AA0CC")
static let LightBlue = UIColor(hex: "#9AC9FF")
// Colors borrowed from Tweetbot's dark color scheme
@daggerhart
daggerhart / wordpress-missing-functions.php
Created March 24, 2016 22:19
WordPress functions that I tend to write often
<?php
/**
* Get a WP_Post object by its slug ( post_name )
*
* @param $post_name
*
* @return WP_Post|null
*/
function get_post_by_slug( $post_name ) {
@ctlcltd
ctlcltd / wordpress_low-quality-image-placeholders_lqip.md
Last active June 22, 2023 20:08
How to easily generate low quality image placeholders (lqip) in WordPress

How to easily generate low quality image placeholders (lqip) in WordPress

I have made this function using the WP_Image_Editor class and I have filtered through the "wp_generate_attachment_metadata" hook. You can modify the "theme" namespace into function names with your theme name or in anyway you like.

Applying the filter directly to wp_generate_attachment_metadata the image placeholders are auto added into WordPress metadata, so when your add/modify/delete an image (or regenerate it via a plugin), it accomplishes to modify also to the image placeholders.

The use of the native theme support can prevent the generation of lqip or target specific image sizes to generate.

It contains an hook filter lqip_quality to modify the quality without have to modify the function.

@thefuxia
thefuxia / login-form-widget.php
Last active October 23, 2016 16:38
WordPress Plugin: T5 Log In Form Widget
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Log in form widget
* Plugin URI: https://gist.github.com/toscho/c7459ee439fd2491c1f6
* Description: Shows a log in form in a widget.
* Version: 13.10.15
* Required: 4.0
* Author: Thomas Scholz <info@toscho.de>
* Author URI: http://toscho.de
* License: MIT
@daggerhart
daggerhart / 1.WordPress-Developer-Environment-Setup.md
Last active March 26, 2023 14:50
Modern WordPress Theme Development

Development Software

  • VirtualBox - Virtualization software for running local operating systems within your computer. This allows us have a full version of linux within our computers that better match how a live webserver works.
  • Vagrant - A tool for provisioning (creating) virtual machines.
  • VVV - A pre-built, community-supported Vagrant configuration for WordPress development.
  • Git - Version control system for managing code during development. Easily allows for tracking changes, and merging new code into an existing project.
  • SourceTree - A GUI available on Windows and Mac for managing Git projects. This makes Git much easier to use, as we won't have to learn the command line interface.
  • Github.com - A website that provides free Git repositories for both open source and private projects.
  • SASS - (SCSS) A CSS preprocessing implementation that allows us to write much less CSS for a project. This basically makes CSS into a simple programming language.
@collindonnell
collindonnell / DeleteManagedObjectsExtension.swift
Last active December 4, 2020 23:38
NSManagedObjectContext extension methods to delete all managed objects, or all objects of a given type in the context.
//
// Created by Collin Donnell on 7/22/15.
// Copyright (c) 2015 Collin Donnell. All rights reserved.
//
import CoreData
extension NSManagedObjectContext {
convenience init(parentContext parent: NSManagedObjectContext, concurrencyType: NSManagedObjectContextConcurrencyType) {
@craigsdennis
craigsdennis / Okay.swift
Last active June 8, 2016 10:40
Regular Expressions in Swift
let title = "Regular Expressions in 10 different languages"
// Match
let pattern = ".*\\d.*"
if let match = title.rangeOfString(pattern, options: .RegularExpressionSearch) {
println("We had a match!")
}
let re = NSRegularExpression(pattern: "(\\d+)", options: nil, error: nil)!
let matches = re.matchesInString(
@johnbillion
johnbillion / hierarchy.php
Last active June 22, 2023 23:05
ASCII WordPress Template Hierarchy
<?php
/*
WordPress Theme Template Hierarchy Last updated for WordPress 5.4
==================================
This diagram is partially simplified for legibility. To view the complete template hierarchy in use on your site see the
Template panel in the Query Monitor plugin.
@smallbizgeek
smallbizgeek / InstantWP Browser Preference
Created March 14, 2015 18:07
InstantWP Browser Configuration
[Browser]
BrowserType=EXTERNAL
BrowserCommandOptions=
BrowserPath= C:\Program Files\Mozilla Firefox\firefox.exe
WorkOfflineTitle=InstantWP
BrowserSize=