Skip to content

Instantly share code, notes, and snippets.

View peterpham's full-sized avatar

Peter Pham peterpham

  • Amazon Web Services
  • Sydney
View GitHub Profile
@Kostanos
Kostanos / json-to-csv.php
Created May 24, 2013 03:28
Convert JSON array file to CSV. Use the array keys as the first row. Command line using: json-to-csv.php json.filename > csv.filename
#!/usr/bin/php
<?php
/*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
* and the same keys in each object.
* The order of keys it took from the first element.
*
* Example:
@steveglachan
steveglachan / JVM Memory Heap Dump
Last active August 29, 2015 14:21
Short batch script used to dump and zip/archive the memory heap used by the Adobe ColdFusion (version 9) Jrun (J2EE Application Server) instance.The memory heap dump can then be analysed for memory leaks using VisualVM software.
:: ---
:: Script for JVM Memory Heap Dump
:: - Adobe ColdFusion 9, JRun, JDK 1.6.x, MS Windows
:: Dependencies:
:: - PSEXEC: https://technet.microsoft.com/en-au/sysinternals/bb897553.aspx
:: - JDK: The JDK library versions for JVM and JMAP utility must match (e.g. both 1.6.x)
:: - 7-ZIP: Command-line archiving utility
:: - *** RUN THIS BATCH SCRIPT AS ADMINISTRATOR ***
:: Recommended:
:: - VisualVM (https://visualvm.java.net/) for analysis of the memory heap dump
@paulirish
paulirish / what-forces-layout.md
Last active July 5, 2024 08:26
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@luruke
luruke / smashingmagazine.js
Last active January 12, 2022 15:34
Source code of the demo "Improving User Flow Through Page Transitions" on Smashing Magazine.
/*
https://www.smashingmagazine.com/2016/07/improving-user-flow-through-page-transitions/
You can copy paste this code in your console on smashingmagazine.com
in order to have cross-fade transition when change page.
*/
var cache = {};
function loadPage(url) {
if (cache[url]) {
@valacar
valacar / search-for-selected-text.js
Created March 13, 2018 01:10
[userscript] Search for selected text
// ==UserScript==
// @name Search for selected text
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Valacar
// @include https://*
// @include http://*
// @grant GM_openInTab
// ==/UserScript==