Skip to content

Instantly share code, notes, and snippets.

// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.
@luetkemj
luetkemj / wp-query-ref.php
Last active September 14, 2024 13:06
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@moyarich
moyarich / calc-elem.scss
Created August 4, 2012 23:44
using SASS to convert/calculate css sizes from px to em, px to percent and em to px; also has function to remove units / (Design in pixels then convert it to em or percent)
//----- Global variables-------------
$mr-grid-width: 1200px !default; // The wrapper/container size$mr-gutter-width: 20px !default; // The amount of margin between columns
$mr-em-base: 16px !default;
$mr-convert-to: "%" !default;
//----------------------------------
@function -mr-grid-col-width($cols, $grid-width:$mr-grid-width, $grid-total-cols:$mr-grid-total-column, $gutter-width: $mr-gutter-width){
//$cols The number of columns used to create the current elements width.
@return ($grid-width / $grid-total-cols) * $cols - $gutter-width;
@remyperona
remyperona / gist:13348dbcd2bbb0d9406f
Created April 14, 2015 14:32
WordPress customizer custom tinymce control
class Text_Editor_Custom_Control extends WP_Customize_Control
{
public $type = 'textarea';
/**
** Render the content on the theme customizer page
*/
public function render_content() { ?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php
@phpfiddle
phpfiddle / fiddle_094751.php
Created May 26, 2017 14:31
[ Posted by Moya ] ratings stars code any percentages as well as 1/2 stars
<style type="text/css">
.rating-frame {
width: 90px;
height: 17px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAiCAIAAADd1h6tAAACXUlEQVQ4y5VTW27aUBCdJWQJXQpLyRK6gywhS+gSKrUf5CdK04JrwCIxuGnA+IEBJwYDtpMQMI/bczEpD19LcDUajWbmeM48TEz0ptNpoViEZhmPhF7TspRqtanrJ8Dm87lcKtm2DQ37WFjbcSqKMhwOLcuCfSxMLpdN05xMJrPZLKsg9VwXn6xrGgRFCpJUrVZHo9FiseBN2vZvWcaHkgRkIp/D0HelUmk0GoZpdrvdwWAQRdFuBdhBEDiOg25r9XoyJ0qa0TQNFZCxXC5Xq1WaVRiGjWbzf6ub3rx+/75W6/f7wgH4vg+Gz54nGAmYoIf31Ir5PsplRDMniTDIHJBM1pi5AJySJMv4aro3TPjg0LYwfzgsravFcWwYBm4SGttDSNd1b6exPRhWrKqq3mqBUjIxrAi0Ldt2XRdRMQyzAgDhg6XBoyhKTdPEMNDI+lPgzyR50hPD5m9W+ztBnwYbaZ9f/pB/d34CbBmPO/kzNiZo2MfCgseLUCUWETTsY2GdqzPmEwsJGrawIEXmZdC48KScV8z1rj+1v1GgEAsIJKGjO+rmOVueIOVQPDIuOcy/Pw/LtDS4sC6vsJXBh37aJCAzmRMlzYxlYoB5xJ7X4qXEoEDetrrp7dX5MrihuL4uCOl8GGuBH1HkCEby7t/wYbSImcSsHWnx3hDNnCSHPRJr7stfDstcAE7JveJJaXHzh4e2hU2evo6uiT0Q0+j1J2ETL7fEVO4Jf+w1tgfDHcYSTQqcEjYJD1YE++0XwY+oGIZtgiTCu2cBG55enhAVw0Aj60+BP5PkSe8fk+toIJaypK8AAAAASUVORK5CYII=');
background-r
const mongoose = require('mongoose'),
models = require('./models'),
jwt = require('jsonwebtoken')
app.all('*', (req, res, next) => {
const noAuthorization = ['/login', '/resetPassReq', '/resetPass', '/signup'];
if (noAuthorization.indexOf(req.path) !== -1) { // does not require authentication
return next()
}