Skip to content

Instantly share code, notes, and snippets.

Ryan Niswonger rniswonger

Block or report user

Report or block rniswonger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maxov
maxov / README.md
Last active Aug 29, 2015
An explanation of how to share variables between Gulp and Grunt
View README.md

Sharing variables between Gulp and Grunt

Gulp, while being a great build system, isn't perfect. Its plugin system is immature and not as full-featured as Grunt. I created gulp-grunt as a remedy for this problem, making it possible to import tasks from Grunt to gulp.

However, sometimes you want to use variables in both files. How? Well, use an accessory file to define all your variables, and import it from both.

@alanedwardes
alanedwardes / rays.js
Created Dec 24, 2011
Generates animated sun rays using HTML canvas
View rays.js
var rays = new Object({
canvas: false,
context: false,
interval: false,
offset: 0,
init: function(id, colour1, colour2){
this.canvas = document.getElementById(id);
this.context = this.canvas.getContext('2d');
this.canvas.style.background = colour1;
this.context.fillStyle = colour2;
@psebborn
psebborn / countCSSRules.js
Last active Jan 18, 2019
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
View countCSSRules.js
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@maban
maban / Maban Website Contract.md
Last active Jul 8, 2019 — forked from malarkey/Contract Killer 3.md
My boilerplate contract
View Maban Website Contract.md

Website Contract [month] [year]

Description of this Contract

This contract is not meant to trick or deceive you; the intention is purely to protect both parties. I have tried to keep the wording as plain as possible, but if anything is unclear, please let me know and I will be more than happy to clarify it with you. Also, until you sign it, please feel free to request to change bits of it to suit your requirements.

In short, [client name] is contracting me, [my name], to [description of my role] between [start date and finish date].

By signing this, you are confirming that you have the power and ability to enter into this contract on behalf of [client's company].

@rmpel
rmpel / wp-499-up-fix-csv-upload.php
Last active Jul 25, 2019
A filter (an mu-plugin) to restore CSV upload functionality to WordPress 4.9.9 and up.
View wp-499-up-fix-csv-upload.php
<?php
/**
* Restore CSV upload functionality for WordPress 4.9.9 and up
*/
add_filter('wp_check_filetype_and_ext', function($values, $file, $filename, $mimes) {
if ( extension_loaded( 'fileinfo' ) ) {
// with the php-extension, a CSV file is issues type text/plain so we fix that back to
// text/csv by trusting the file extension.
$finfo = finfo_open( FILEINFO_MIME_TYPE );
$real_mime = finfo_file( $finfo, $file );
@retlehs
retlehs / header.php
Created Apr 29, 2015
Sage header template for Bootstrap top navbar component
View header.php
<?php
// This file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker
// somewhere in your theme.
?>
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
@bitfade
bitfade / gist:4555047
Last active Sep 25, 2019
WordPress - Remove empty p tags for custom shortcodes
View gist:4555047
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
@jonathanstark
jonathanstark / verify-google-recaptcha-with-php
Last active Oct 8, 2019
Verify Google reCAPTCHA with PHP
View verify-google-recaptcha-with-php
#
# Verify captcha
$post_data = http_build_query(
array(
'secret' => CAPTCHA_SECRET,
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
)
);
$opts = array('http' =>
@jsonmaur
jsonmaur / bzexcluderules_editable.xml
Last active Oct 9, 2019
Backblaze Custom Exclude
View bzexcluderules_editable.xml
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
@sgaulding
sgaulding / own.dg.theme
Last active Nov 21, 2019
SmartGit Dark Theme (SmartGit Version 17.1)
View own.dg.theme
# This file lists the color values of the default dark theme.
# Each line starting with a # is a comment.
# To overwrite certain colors remove the leading # and change the color values.
# The "extends" line defines which color definitions to use if none is found here.
extends=deepgit-dark-theme.properties
# The "preferredEditorTheme" line determines what editor theme should be used by default ('light' or 'dark').
preferredEditorTheme=dark
You can’t perform that action at this time.