Skip to content

Instantly share code, notes, and snippets.

@rmzse
rmzse / wp-query-ref.php
Created June 26, 2020 15:44 — forked from luetkemj/wp-query-ref.php
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
*/
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|webp|svg|gif|woff|woff2|js|css)$">
Header set Cache-Control "max-age=31536000, public"
Header append Vary: Accept-Encoding
Header set Access-Control-Allow-Origin “*”
</filesMatch>
<ifmodule mod_deflate.c>
<ifmodule mod_mime.c>
AddType application/x-font-ttf .ttf
AddType application/font-woff .woff
@rmzse
rmzse / random-class.js
Created May 2, 2020 19:12 — forked from gabydevdev/random-class.js
add random classes - js
(function($){
$(document).ready(function() {
var classes = [ 'style1', 'style2', 'style3' ]; // the classes you want to add
$('.item').each(function(i) { // the element(s) you want to add the class to.
$(this).addClass(classes[ Math.floor( Math.random()*classes.length ) ] );
});
});
})(jQuery);
@rmzse
rmzse / registrations_controller.rb
Created February 9, 2017 08:45 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@rmzse
rmzse / gist:506e215803f245b8fb07ab42236f049d
Created February 4, 2017 18:33 — forked from mrcasals/gist:2788529
Rails: Reinstall postgreSQL via brew ang pg gem on Mac OS X
$ brew uninstall postgresql
$ gem uninstall pg # ALL OF THEM
$ rm -fr /usr/local/var/postgres
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
$ pg_ctl -D /usr/local/var/postgres stop -s -m fast # WE SHOULD HAVE ALL postgres SERVERS & PROCESSES STOPPED BY NOW
$ brew install postgres
$ env ARCHFLAGS="-arch x86_64" gem install pg
$ echo "DONE." >> /dev/null