Skip to content

Instantly share code, notes, and snippets.

@lkhedlund
lkhedlund / Bluloco.tet
Last active October 14, 2023 20:12
Godot Bluloco Theme
[color_theme]
background_color="f9f9f9"
completion_background_color="e5e5e5ff"
completion_selected_color="d5d5d5ff"
completion_existing_color="dfdfdf21"
completion_scroll_color="959595ff"
completion_font_color="454545ff"
caret_color="54494bff"
caret_background_color="000000ff"
<?php
class Place_Reviews {
// URL to the Google Place API
protected $apiUrl = 'https://maps.googleapis.com/maps/api/place/details/json';
// Google Place ID
protected $place_id;
public function __construct($place_id)
@lkhedlund
lkhedlund / customizer_sanitizers.php
Created April 15, 2020 19:34
Sanitizer examples for customizer settings.
<?php
// Sanitize Select fields
function sanitize_select($input, $setting) {
$input = sanitize_key($input);
$choices = $setting->manager->get_control($setting->id)->choices;
return (array_key_exists($input, $choices) ? $input : $setting->default);
}
// Sanitize Checkboxes
@lkhedlund
lkhedlund / rename_files.py
Last active March 30, 2020 17:35
Replace commas in directory filenames (Current folder)
# Download into directory and run `python rename_files.py`
# importing os module
import os
# Function to rename multiple files
def main():
for filename in os.listdir("./"):
# Replace commas in filename with nothing
@lkhedlund
lkhedlund / block.js
Last active June 18, 2020 08:30
Gutenberg: Custom Block Category
registerBlockType( 'loomo/yoshi-cookies', {
category: 'mario-blocks', // Block category
@lkhedlund
lkhedlund / .htaccess
Created May 1, 2017 18:04 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@lkhedlund
lkhedlund / bootstrap-pagination.php
Last active September 5, 2017 21:30 — forked from ediamin/bootstrap-pagination.php
Bootstrap v4-alpha6 Pagination for WordPress
/*
* custom pagination with bootstrap .pagination class
* source: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/
*/
function bootstrap_pagination( $echo = true ) {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
@lkhedlund
lkhedlund / indentation_space_formatter.py
Created November 25, 2015 03:36
This program takes an argument using the command line and applies the corresponding changes to the input document.
import sys
HEADER = """
==HELP DOCUMENT==
Indentation and Space Formatter by Lars Hedlund
==INSTRUCTIONS==
This program takes an argument using the command line and applies the corresponding
changes to the input document. The commands and changes are as follows:
------------------------------------------------------------------------------
@lkhedlund
lkhedlund / classical_inheritance.rb
Last active November 4, 2015 05:18
In this exercise, we will take a step back from testing and create a mini program with multiple classes that inherit from each other
#init
module Flight
attr_accessor :airspeed_velocity
def fly
"I'm a #{self.class.name}, I'm flying!"
end
end
# =============================