Skip to content

Instantly share code, notes, and snippets.

View patmigliaccio's full-sized avatar

Pat Migliaccio patmigliaccio

View GitHub Profile

Logseq Plugin Setup Guide

[WIP] Logseq Plugin System is currently under Alpha Testing phase.

For Developers

In this short guide, it will walk you through the steps needed to set up your development environment for writing and running a hello world simple inside of Logseq Desktop Client. You know Logseq Plugin based on Web Technologies composed of JS & HTML & CSS, but neither are mandatory, you can develop plugins use any language which can be translated to javascript (Logseq made by Clojurescript!). We will use Typescript to demonstrate this sample. Because there is a type definition file to make development experience even better.

Install Node.js and NPM

dragonza / chunk.js
Last active May 12, 2019 17:25
Chunk array
function chunk(array, size) {
if (!array) return [];
const firstChunk = array.slice(0, size); // create the first chunk of the given array
if (!firstChunk.length) {
return array; // this is the base case to terminal the recursive
return [firstChunk].concat(chunk(array.slice(size, array.length), size));
M0nica / .gitattributes
Created September 4, 2017 23:09
Remove vendor files from GitHub's classification of the repositories language
static/* linguist-vendored
john-doherty / javascript-trim-svg-whitespace.js
Created October 21, 2016 13:39
Trim whitespace from SVG elements
function trimSvgWhitespace() {
// get all SVG objects in the DOM
var svgs = document.getElementsByTagName("svg");
// go through each one and add a viewbox that ensures all children are visible
for (var i=0, l=svgs.length; i<l; i++) {
var svg = svgs[i],
box = svg.getBBox(), // <- get the visual boundary required to view all children
leocaseiro / .htaccess
Last active February 23, 2022 03:59
Angular html5Mode apache working in a subdirectory /app using ngRoute
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /app/index.html [NC,L]
ghinda / object-to-form-data.js
Last active May 21, 2024 20:48
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
justmoon / custom-error.js
Last active April 22, 2024 17:19 — forked from subfuzion/
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor); =;
this.message = message;
this.extra = extra;
require('util').inherits(module.exports, Error);
demisx /
Last active May 17, 2024 03:38
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes


CMCDragonkai /
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
rgreenjr / postgres_queries_and_commands.sql
Last active June 19, 2024 21:11
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'