Skip to content

Instantly share code, notes, and snippets.

micmro / mean.sublime-project
Created June 30, 2014 14:16 Sublime project file
"path": ".",
//"name" : "Mean Project Name",
"file_exclude_patterns": [
micmro / third-party-calls.sql
Last active August 29, 2015 14:07
bigQuery HTTP Archive - requests
/* WIP - not working yet */
NTH(10, num_requests) thenth,
NTH(25, num_requests) twenty_fifth,
NTH(50, num_requests) median,
NTH(75, num_requests) seventy_fifth,
NTH(90, num_requests) ninetieth
SELECT COUNT(*) num_requests
micmro / ResourceDuration
Created November 19, 2014 04:49
Page Resources ordered by duration
window.performance.getEntriesByType("resource").sort(function(a, b) {
return b.duration - a.duration;
micmro / cssToJSVariable.js
Created November 20, 2014 04:14
Grunt-task for a quick and dirty conversion from a CSS file to a JS file containing the CSS as a variable
//transform CSS file to JS variable
grunt.registerTask("inlineCssToJs", function() {
var cssFile = "src/style.css";
var cssFileDestination = "dist/style.js";
var varName = "cssFileText";
var cssContent =;
//clean CSS content
cssContent = cssContent.replace( /\/\*(?:(?!\*\/)[\s\S])*\*\//g, "").replace(/[\r\n\t]+/g, " ").replace(/[ ]{2,}/g, " ").replace(/\"/g,"\\\"");
micmro / jquery.asyncOn
Last active August 29, 2015 14:16
Non blocking event listener for jQuery
* usage: exactly like like jQuery's `on`
* $("#xyz").on("click", function(){ ... }); => $("#xyz").asyncOn("click", function(){ ... });
* $("#xyz").one("click", function(){ ... }); => $("#xyz").asyncOne("click", function(){ ... });
asyncOn : function(types, selector, data, fn, one){
/*based on*/
var type, origFn;
micmro / Dockerfile
Last active February 12, 2016 07:24
WSO2 Identity Server 5.1 Dockerfile
FROM clifton/oracle-java8
COPY /wso2is-5.1.0 /opt/wso2is
CMD ["/opt/wso2is/bin/"]
micmro / .zshrc
Last active January 12, 2017 22:50
Automatically add ssh key to ssh-agent in shell if it had not been added yet
# add ssh key to ssh-agent if it had not been added yet
ssh-add -l | grep -q "$HOME/.ssh/id_rsa" || ssh-add $HOME/.ssh/id_rsa
micmro / fix-flex-svg-panels.html
Last active December 28, 2017 10:35
SVG with both fixed width (pixel) and flexible with (percentage) panels combined - - does not work in IE/Edge due to lack of support for SVG in `foreignObject`
<svg width="100%" height="250" xmlns="">
<foreignObject id="fixed-panel" width="100" height="100%">
<svg width="100" xmlns="">
<rect x="0" y="0" width="100" height="100%" fill="#fcc" rx="5" ry="5"/>
<text x="5%" y ="25" width="100" fill="#333">fixed width</text>
<foreignObject id="flex-panel" width="100%" height="100%" style="padding-left:100px;">
type description release type
micmro / manual-typing-of-npm-module.d.ts
Last active November 22, 2021 09:15
Add a custom type definition file for an existing (non-typed) npm module, while automatically pick up the typing (for both Typescript or Javascript in case of VS Code). Typings are contained in the `typings/` directory
//real file is in: `typings/swagger-express-mw/index.d.ts` (relative to tsconfig.json)
import {Config, ConnectMiddleware} from "../swagger-node-runner"
* Create a new instance of Connect specific SwaggerNodeRunner
export function create(config: Config, cb: {(err: Error | undefined, runner: ConnectMiddleware): void}): void