Skip to content

Instantly share code, notes, and snippets.

@ctsstc
ctsstc / tabs-outliner-collapse-all.js
Last active June 15, 2023 19:24
Tabs Outliner - Collapse All
treeView.treeModel.currentSession_rootNode.subnodes.forEach(node => node.setCollapsing(true))
@stefanmaric
stefanmaric / copy-to-clipboard-bookmarklet.md
Created September 7, 2016 20:54
Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard

Copy-to-clipboard Bookmarklet

Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.

This is the base javascript:

(function (text) {
  var node = document.createElement('textarea')
  var selection = document.getSelection()
@LiamKarlMitchell
LiamKarlMitchell / ToggleRows.js
Created August 22, 2015 23:31
Google sheets toggle, hide, show rows.
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name: "Toggle Rows",
functionName: "toggleRows"
},{
name: "Hide Rows",
functionName: "hideRows"
},{
name: "Show Rows",
@ellisgeek
ellisgeek / Import-Excel.ps1
Last active September 7, 2023 13:19
Import Excel file into powershell in a manner compatible with Import-Csv
function Import-Excel {
<#
.SYNOPSIS
Creates table-like custom objects from the items in a Excel file.
Requires Excel be installed!
.DESCRIPTION
The Import-Excel cmdlet creates table-like custom objects from the items in Excel
Worksheets.
Each column in the Excel Worksheet becomes a property of the custom object and the items in
rows become the property values. Import-Excel works on any file supported by Excel.
@spiralx
spiralx / dopus-utils.jscript
Created May 19, 2014 16:16
Collection and debug functions for Directory Opus 11 scripts
@script:jscript
/**
* Return an array of the results of running func on each item in coll e.g.
* map(DOpus.vars, function(v, i) {
* return v + '=' + v.value;
* }
*/
function map(coll, func) {
var res = [];
@liunian
liunian / gist:9338301
Last active April 26, 2024 03:30
Human Readable File Size with PHP
<?php
# http://jeffreysambells.com/2012/10/25/human-readable-filesize-php
function human_filesize($bytes, $decimals = 2) {
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor];
}
echo human_filesize(filesize('example.zip'));
@steve-jansen
steve-jansen / ExportVisualBasicCode.bas.vb
Created November 21, 2013 20:56
Excel macro to export all VBA source code in this project to text files for proper source control versioning
' Excel macro to export all VBA source code in this project to text files for proper source control versioning
' Requires enabling the Excel setting in Options/Trust Center/Trust Center Settings/Macro Settings/Trust access to the VBA project object model
Public Sub ExportVisualBasicCode()
Const Module = 1
Const ClassModule = 2
Const Form = 3
Const Document = 100
Const Padding = 24
Dim VBComponent As Object