Skip to content

Instantly share code, notes, and snippets.

View lamuertepeluda's full-sized avatar
🇮🇹
Italy

Vito Macchia lamuertepeluda

🇮🇹
Italy
  • Turin, Italy
  • 07:09 (UTC +02:00)
View GitHub Profile
@ttimasdf
ttimasdf / Open iterm tab here
Last active March 1, 2020 17:49 — forked from eric-hu/Open iterm tab here
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder.To use:(1) Open Automator(2) Create a new service(3) Change "Service receives selected" drop downs to "Files or folders" in "Finder"(4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set is_folder to (do shell script "file -b " & quoted form of (POSIX path of my_file))
if is_folder ends with "directory" then

When you want to use a asynchronous loading technique (like requireJS for instance) in a Windows HTML application you can have trouble catching the activation event due to the fact that WinJS.Application.start() must be called synchronously at the start of the process in order to register with the system's activation handler at the right time.

Here is a code snippet which describes a way to work around that by using an artifical event to stall the WinJS.Application event queue until your activation handler is registered and ready to run.

    (function () {
        "use strict";

        // Alias the application object
        var app = WinJS.Application;
@nicksteffens
nicksteffens / JS window.location.query
Created February 25, 2014 17:52
JS window.location.search parse
// parse location.search
if(!window.location.query) {
window.location.query = function(){
var map = {};
if ("" != this.search) {
var groups = this.search.substr(1).split("&"), i;
for (i in groups) {
i = groups[i].split("=");