Skip to content

Instantly share code, notes, and snippets.

@rsanchez
rsanchez / Vagrantfile
Created January 23, 2020 22:34 — forked from jeebak/Vagrantfile
A vagrant replacement for ievms (for Linux, and macOS hosts)
# Usage: vagrant up windowsVersion-IEversion
#
# Eg. vagrant up win10-edge
#
# Based off of: # https://gist.github.com/anthonysterling/7cb85670b36821122a4a
boxes = {
# http://www.vagrantbox.es/
"xp-6" => "https://aka.ms/ie6.xp.vagrant",
"xp-8" => "https://aka.ms/ie8.xp.vagrant",
"vista-7" => "https://aka.ms/ie7.vista.vagrant",
@rsanchez
rsanchez / .psysh.php
Created November 5, 2019 16:24
Bootstrap Craft 3 for Psysh
<?php
/**
* Craft console bootstrap file
*/
// Set path constants
define('CRAFT_BASE_PATH', __DIR__);
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH . '/vendor');
// Load Composer's autoloader
@rsanchez
rsanchez / json-formatter-bookmarklet.js
Created August 9, 2019 17:01
JSON Formatter bookmarklet
javascript:if("application/json"===document.contentType){window.module={};const e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/json-formatter-js@2.2.1/dist/json-formatter.js",e.type="module",e.addEventListener("load",()=>{const e=JSON.parse(document.body.innerText);document.body.innerHTML="";const n=new window.module.exports.default(e,6);document.body.appendChild(n.render())}),document.head.appendChild(e)}
@rsanchez
rsanchez / read-logentries
Created April 23, 2018 14:26
read logentries
#!/usr/bin/env php
<?php
if (empty($argv[1])) {
fwrite(STDERR, 'Usage: read-logentries /path/to/your.log.gz'.PHP_EOL);
exit(1);
}
$file = $argv[1];
/**
* Simple userland heapdump generator using v8-profiler
* Usage: require('[path_to]/HeapDump').init('datadir')
*
* @module HeapDump
* @type {exports}
*/
var fs = require('fs');
var profiler = require('v8-profiler');
@rsanchez
rsanchez / ee-slow-query-log.js
Last active February 19, 2016 19:54
EE slow query log
// Uses localStorage to keep a running log of all queries on the site
// so you can browse through the site and identify the biggest query
function EESlowQueryLog() {
// get cached queries
var queries = localStorage.getItem("EESlowQueryLog") ? JSON.parse(localStorage.getItem("EESlowQueryLog")) : [];
function loadQueries() {
// loop through all queries
$("#ci_profiler_queries_db_1 tr").each(function() {
// get this execution time of this query
@rsanchez
rsanchez / README.md
Last active October 31, 2015 14:09
EE3 Add-on Update Status
<?php
$site_id = ee()->config->item('site_id');
$site_pages = base64_encode(
serialize(
array(
$site_id => array(
'url' => 'http://yoursite.com//',
'uris' => array(
68 => '//',
@rsanchez
rsanchez / mysql_driver.php
Created July 7, 2015 21:04
EE log sql queries to file
<?php
function _execute($sql)
{
$sql = $this->_prep_query($sql);
### HACK START
$is_write = preg_match('/^(insert|update|delete|alter|create|drop)/i', $sql);
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='./mapbox.js'></script>
<script src='./leaflet.markercluster-src.js'></script>
<link href='./mapbox.css' rel='stylesheet' />
<link href='./MarkerCluster.css' rel='stylesheet' />
<link href='./MarkerCluster.Default.css' rel='stylesheet' />
<!--[if lte IE 8]>