Skip to content

Instantly share code, notes, and snippets.

View isorna's full-sized avatar
😃
New projects on the horizon

Alvaro Isorna isorna

😃
New projects on the horizon
View GitHub Profile
@isorna
isorna / generate-vitepress-sidebar.ts
Last active March 14, 2024 18:36
Auto generate Vitepress sidebars using front-matter for link text and ordering
import { SidebarItem } from './types'
import fs from "fs"
import path from "path"
import fm from 'front-matter'
/**
* Uses the following custom frontmatter structure to generate custom links, folder links and ordering docs:
* ---
* categoryTitle: 'Glossary'
* excerpt: 'Project glossary index.'
@isorna
isorna / macos-configuration.md
Last active April 15, 2024 07:16
My default MacOS configuration routine for new devices

Show hidden folders and files on MacOS

defaults write com.apple.finder AppleShowAllFiles true; killall Finder

Fix 'xcrun: error: invalid active developer path, missing xcrun'

xcode-select --install

@isorna
isorna / rules.bolt
Created November 13, 2015 11:41 — forked from davideast/rules.bolt
Securing user data - Bolt rules
isUser(uid) = auth != null && auth.uid == uid;
type Post {
uid: String;
title: String;
description: String;
timestamp: Number;
}
type User {
// requires jQuery or similar
function parseFormToJSON (pcSelector) {
var aFieldsArray = $(pcSelector).serializeArray(),
oJSON = {},
i = 0;
for (i = 0; i < aFieldsArray.length; i++) {
oJSON[aFieldsArray[i].name] = aFieldsArray[i].value;
}
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@isorna
isorna / extend.js
Last active August 29, 2015 14:16 — forked from katowulf/extend.js
function extend(base) {
var parts = Array.prototype.slice.call(arguments, 1);
parts.forEach(function (p) {
if (p && typeof (p) === 'object') {
for (var k in p) {
if (p.hasOwnProperty(k)) {
base[k] = p[k];
}
}
}
@isorna
isorna / designer.html
Created August 14, 2014 07:07
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
// source: http://javascriptweblog.wordpress.com/2011/05/31/a-fresh-look-at-javascript-mixins/
function extend(destination, source) {
for (var k in source) {
if (source.hasOwnProperty(k)) {
destination[k] = source[k];
}
}
return destination;
}
@isorna
isorna / WP_SitesToCSV.js
Created January 23, 2014 10:43
Export to CSV with javascript from WordPress site's listing
// Filter and export site's listing data
// columns: 'Domain', 'Parent Theme', 'Bootstrap', 'Mobile Version', 'Data Integration'
if (jQuery('body').hasClass('sites-php')) {
var aCSVData = [], cOutput = '', cURI = '';
jQuery('#the-list tr:not(.site-deleted)').each(function () {
var aTMP = [], cTMP = '', cTMP2 = '';
cTMP = jQuery('.blogname a', this).html().replace(/"/g, '""');
function createCORSRequest (poMethod, pcURL) {
var oXHR = new XMLHttpRequest();
if ('withCredentials' in oXHR) {
// Check if the XMLHttpRequest object has a "withCredentials" property.
// "withCredentials" only exists on XMLHTTPRequest2 objects.
oXHR.open(poMethod, pcURL, true);
} else if (typeof XDomainRequest != 'undefined') {
// Otherwise, check if XDomainRequest.
// XDomainRequest only exists in IE, and is IE's way of making CORS requests.