Skip to content

Instantly share code, notes, and snippets.

@adrianwong
adrianwong / mathjax-responsive-scaling.html
Last active Dec 6, 2019
Responsive scaling of MathJax formulae
View mathjax-responsive-scaling.html
<script type="text/javascript">
window.MathJax = {
jax: ["input/TeX", "output/CommonHTML"],
extensions: ["tex2jax.js"],
TeX: {
equationNumbers: { autoNumber: "AMS" },
extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]
},
/* The MathJax API provides us with the ability to register
callbacks on signals broadcast during its startup sequence.
@a-am
a-am / gulpfile.js
Created Aug 19, 2015
Gulp Start File
View gulpfile.js
/*
* Gulp install plugins
* @package.json
*/
var gulp = require('gulp'),
gulpLoadPlugins = require('gulp-load-plugins'),
$ = gulpLoadPlugins(),
LessPluginAutoPrefix = require('less-plugin-autoprefix'),
autoprefix = new LessPluginAutoPrefix({ browsers: ["last 2 versions"] }),
filter = require('gulp-filter');
@yratof
yratof / functions.php
Created Mar 10, 2015
ACF OEmbed with thumbnails
View functions.php
<?php
/* Pull apart OEmbed video link to get thumbnails out*/
function get_video_thumbnail_uri( $video_uri ) {
$thumbnail_uri = '';
// determine the type of video and the video id
$video = parse_video_uri( $video_uri );
// get youtube thumbnail
@bomberstudios
bomberstudios / sketch-plugins.md
Last active Oct 16, 2020
A list of Sketch plugins hosted at GitHub, in no particular order.
View sketch-plugins.md
@fjarrett
fjarrett / gist:5544469
Last active Jun 17, 2019
Return an attachment ID using a URL in WordPress
View gist:5544469
<?php
/**
* Return an ID of an attachment by searching the database with the file URL.
*
* First checks to see if the $url is pointing to a file that exists in
* the wp-content directory. If so, then we search the database for a
* partial match consisting of the remaining path AFTER the wp-content
* directory. Finally, if a match is found the attachment ID will be
* returned.
*
@shanselman
shanselman / gist:5422230
Last active Apr 11, 2021
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
View gist:5422230
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active Mar 5, 2021
Using Git with Subversion Mirroring for WordPress Plugin Development
View wordpress-plugin-svn-to-git.md
@marcedwards
marcedwards / high-dpi-media.css
Last active Apr 4, 2021
A CSS media query that captures almost all high DPI aware devices.
View high-dpi-media.css
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@rayfranco
rayfranco / APACHE: .htaccess pushstate
Created Jul 30, 2012
.htaccess for HTML5 Pushstate support
View APACHE: .htaccess pushstate
<ifModule mod_rewrite.c>
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html
</ifModule>
@cowboy
cowboy / github_post_recieve.php
Created Oct 11, 2010
GitHub PHP webhook to auto-pull on repo push
View github_post_recieve.php
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi