Skip to content

Instantly share code, notes, and snippets.

View deanbot's full-sized avatar

Dean Verleger deanbot

View GitHub Profile
@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
*/
$(document).ready(function(){
var scriptbase = _spPageContextInfo.webServerRelativeUrl + "_layouts/15/";
$.getScript(scriptbase + "SP.Runtime.js",
function () {
$.getScript(scriptbase + "SP.js", function(){
$.getScript(scriptbase + "SP.Taxonomy.js", execOperation);
@jonschlinkert
jonschlinkert / markdown-cheatsheet.md
Last active November 4, 2024 16:00
A better markdown cheatsheet.
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@hyamamoto
hyamamoto / broadcast_basic.dart
Created March 3, 2014 06:23
Snippets to show basic use of "Dart Stream API" in case I forget. (written for dart-1.3.0-dev)
import 'dart:async';
void main() {
var data = [1,2,3,4,5];
var stream = new Stream.fromIterable(data);
var broadcastStream = stream.asBroadcastStream();
broadcastStream.listen((value) => print("(3)stream.listen: $value"));
broadcastStream.first.then((value) => print("(3)stream.first: $value")); // 1
-- delete any usermeta specific to the other subsites
delete from wp_usermeta where meta_key regexp '^wp_([0-9]+)_';
-- duplicate the wp_usermeta structure in a working data table,
-- but add a unique index for filtering out duplicates
create table _fix_usermeta like wp_usermeta;
alter table _fix_usermeta add unique(user_id, meta_key);
-- copy the site-specific usermeta, keeping only the last of each duplicate
insert into _fix_usermeta
@felipeskroski-zz
felipeskroski-zz / degToCard.js
Last active February 24, 2022 20:27
Javascript function to convert wind direction in degrees to cardinal.
var degToCard = function(deg){
if (deg>11.25 && deg<=33.75){
return "NNE";
}else if (deg>33.75 && deg<=56.25){
return "ENE";
}else if (deg>56.25 && deg<=78.75){
return "E";
}else if (deg>78.75 && deg<=101.25){
return "ESE";
}else if (deg>101.25 && deg<=123.75){
@mcandre
mcandre / git-ssh-access-faq.md
Last active October 16, 2024 14:21
Git/SSH Access Frequently Asked Questions

Git/SSH Access FAQ

If you see Access denied, or other error messages when trying to access a git repository or SSH server, here are some steps you can take to resolve the problem.

Enable verbose mode

When in doubt, run ssh -vvv <other options...> to enable more verbose logging.

How do I request git repo / ssh permissions?

@eyy
eyy / app.js
Last active April 3, 2021 18:57
Auto reload everything: stylus, browser-sync, express, nodemon
var app = express()
// browser sync
if (app.get('env') === 'development') {
var bs = require('browser-sync')({
logSnippet: false,
files: ['pub/*.html', 'pub/css/*.css', 'views']
})
app.use(require('connect-browser-sync')(bs))
}
@mcandre
mcandre / sort-by-size.md
Last active June 21, 2024 04:22
Sort file and directories recursively by size

UNIX

Files: ls -lSh | tac

Directories: du -hd 1 | sort -h

Requires GNU coreutils (e.g., macOS users can run brew install coreutils).

macOS