Skip to content

Instantly share code, notes, and snippets.

@jbasdf
jbasdf / canvas_lti_variables
Created November 11, 2017 00:49
All Canvas LTI Variables for substitution
context_title: "$Context.title",
com_instructure_post_message_token: "$com.instructure.PostMessageToken",
com_instructure_assignment_lti_id: "$com.instructure.Assignment.lti.id",
com_instructure_originality_report_id: "$com.instructure.OriginalityReport.id",
com_instructure_submission_id: "$com.instructure.Submission.id",
com_instructure_file_id: "$com.instructure.File.id",
course_offering_sourced_id: "$CourseOffering.sourcedId",
context_id: "$Context.id",
context_sourced_id: "$Context.sourcedId",
message_document_target: "$Message.documentTarget",
@thebigreason
thebigreason / social-sharing-alignment.html
Created October 18, 2011 17:48
Align Facebook Like, Twitter Tweet and Google +1 buttons
<div class="social">
<span class="twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="[your-url-here]">Tweet</a>
</span>
<span class="google">
<g:plusone size="medium" href="[your-url-here]"></g:plusone>
</span>
<span class="Facebook">
<iframe src="https://www.facebook.com/plugins/like.php?href=[your-url-here]&amp;show_faces=false&amp;layout=button_count" scrolling="no" frameborder="0" style="height: 21px; width: 100px" allowTransparency="true"></iframe>
</span>
@nickcernis
nickcernis / mailchimp-popup-for-wordpress.md
Last active July 28, 2022 14:49
MailChimp Popup Script that works with WordPress sites

MailChimp's default popup scripts can break on WordPress sites that use jQuery/jQuery UI unless you include their embed code as the final elements before the closing body tag.

Including them in this way isn't always possible or easy with WordPress.

The code below is an alternative implementation of the loader that forces MailChimp's popup scripts to appear below all other scripts upon page load.

To use it, modify the baseUrl, uuid, and lid attributes with the ones from the original popup script that MailChimp supplies.

@kellenmace
kellenmace / class-download-remote-image.php
Last active October 13, 2022 13:24
Download and Insert a Remote Image File into the WordPress Media Library
<?php
/**
* This class handles downloading a remote image file and inserting it
* into the WP Media Library.
*
* Usage:
* $download_remote_image = new KM_Download_Remote_Image( $url );
* $attachment_id = $download_remote_image->download();
*
@matthanger
matthanger / blti-launch.php
Last active October 24, 2022 07:12
Sample code for Basic LTI Consumer in PHP
<?php
# ------------------------------
# START CONFIGURATION SECTION
#
$launch_url = "https://lti.tools/test/tp.php";
$key = "12345";
$secret = "secret";
$launch_data = array(
@M165437
M165437 / ScheduleList.php
Last active November 27, 2022 12:20
PHP Artisan command that lists all scheduled tasks: php artisan schedule:list (Credit: https://stackoverflow.com/a/35559970/2714126)
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\Scheduling\Schedule;
class ScheduleList extends Command
{
/**
@jnrbsn
jnrbsn / GPL.md
Last active April 29, 2023 14:59
A Markdown-formatted GPL for your GitHub projects.

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

@jchamb
jchamb / gist:fdf7d12b0191cb852056
Last active July 25, 2023 16:59
Woocommerce Free Downloads without checkout
function direct_free_downloads_button($button)
{
global $product;
if( $product->is_downloadable() AND $product->get_price() == 0 )
{
$files = $product->get_files();
$files = array_keys($files);
$download_url = home_url('?download_file='.$product->id.'&key='.$files[0].'&free=1' );
@ozh
ozh / gist:4131243
Created November 22, 2012 13:44
Create dot files/directories (ie .file) on Windows

#How to create a .file or .folder on Windows

There are several ways

1. Rename

  • Create file.txt
  • Rename to .file., the last dot will be dropped, you'll have .file

Works the same with a file or a directory.

@cfebs
cfebs / vboxhostonlyssh.md
Last active October 22, 2023 12:32
setup a vbox ubuntu server with host only adapter

Virtualbox dev environment w/ static IP

I can never find a great guide on this stuff, so these are more like notes to myself.

The goal here is to have a virtualbox running more or less headless. An ssh client is used separately to actually use the machine. I've found it to be fantastic for a quick dev setup.

lets go

Assumes you have a vbox setup with Ubuntu server (this will work for 16.04) ready to go.