Skip to content

Instantly share code, notes, and snippets.

View lubyagin's full-sized avatar

Александр lubyagin

View GitHub Profile
@ufo22940268
ufo22940268 / Issue
Created December 18, 2012 01:08
.Xdefaults
foreground: #c5c8c6
background: #1d1f21
cursorColor: #aeafad
color0: #000000
color1: #912226
color2: #778900
color3: #ae7b00
color4: #1d2594
color5: #682a9b
color6: #2b6651
@strangerstudios
strangerstudios / pmpro_customizations.php
Last active May 6, 2021 09:00
Add a one-time-use 14 day trial to a monthly recurring membership level with Paid Memberships Pro. Place this file in wp-content/plugins/pmpro-customizations/pmpro-customizations.php on your site, then active the plugin through the WP dashboard.
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for Paid Memberships Pro (14 day trial on level 1)
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
@romansklenar
romansklenar / crosstab.sql
Last active February 1, 2023 18:46
PostgreSQL "pivot table" example using tablefunc extension
CREATE EXTENSION tablefunc;
CREATE TABLE sales(year int, month int, qty int);
INSERT INTO sales VALUES(2007, 1, 1000);
INSERT INTO sales VALUES(2007, 2, 1500);
INSERT INTO sales VALUES(2007, 7, 500);
INSERT INTO sales VALUES(2007, 11, 1500);
INSERT INTO sales VALUES(2007, 12, 2000);
INSERT INTO sales VALUES(2008, 1, 1000);
INSERT INTO sales VALUES(2009, 5, 2500);
@ryanlerch
ryanlerch / generate-gif-from-webm
Created May 1, 2014 14:47
Generates an Animated GIF from a webm
#!/bin/bash
echo "$1"
mkdir /tmp/"$1"/
gst-launch-1.0 filesrc location="$1" ! decodebin ! videoconvert ! pngenc ! multifilesink location="/tmp/$1/%04d.png"
echo "Trim files manually, and press enter to generate the GIF"
nautilus /tmp/"$1"/ &
read
echo "Generating GIF..."
convert -delay 5 /tmp/"$1"/*.png /tmp/"$1"/animation.gif
@basham
basham / css-units-best-practices.md
Last active November 19, 2024 15:03
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@ambroisemaupate
ambroisemaupate / security.conf
Last active October 14, 2024 07:59
Nginx CSP example
# config to don't allow the browser to render the page inside an frame or iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri
# https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
add_header X-Frame-Options SAMEORIGIN;
# when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header,
# to disable content-type sniffing on some browsers.
# https://www.owasp.org/index.php/List_of_useful_HTTP_headers
# currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx
@intelfx
intelfx / pandoc-lorcode.lua
Last active January 14, 2016 05:33
LORCODE writer for Pandoc
-- This is a custom writer for pandoc for http://linux.org.ru
-- markup language. It has been dirty-hacked from the sample custom
-- writer which produced HTML output.
--
-- Invoke with: pandoc -t sample.lua
--
-- Note: you need not have lua installed on your system to use this
-- custom writer. However, if you do have lua installed, you can
-- use it to test changes to the script. 'lua sample.lua' will
-- produce informative error messages if your code contains
@andrewlimaza
andrewlimaza / pmpro-recurring-donations.php
Last active February 19, 2019 23:24
Recurring Donation for PMPRO
//set price
function pmprodon_pmpro_donation_recurring($level)
{
if(isset($_REQUEST['donation']))
$donation = preg_replace("[^0-9\.]", "", $_REQUEST['donation']);
else
return $level;
if(!empty($donation))
{
@andrewlimaza
andrewlimaza / add-custom-checkout-fields.php
Last active February 19, 2019 23:24
Adding custom fields for Register Helper Pro (PMPRO)
/*
Plugin Name: Register Helper Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Register Helper Customizations
Version: 1.0.0
Author: StrangerStudios
Author URI: http://www.paidmembershipspro.com/
*/
//we have to put everything in a function called on init, so we are sure Register Helper is loaded
@andrewlimaza
andrewlimaza / function_to_change_pmpro_donation_text.php
Last active April 8, 2022 19:35
Function that changes 'Make a Gift' text - PMPRO Donations Add on
<?php
/*
This function simply edits the text 'Make a Gift' for PMPRO Donations Add-On
Please paste this function in your functions.php or custom plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_donations_change_text( $change_text, $text, $domain ) {
switch ( $change_text ) {
case 'Make a Gift' :
$change_text = __( 'This will change Make A Gift', 'pmpro-donations' ); //edit 'This will change Make A Gift' to edit the text output of 'Make a Gift'