Skip to content

Instantly share code, notes, and snippets.

@ttepasse
ttepasse / open-chrome-tabs-in-safari.js
Last active October 14, 2017 21:53 — forked from paulirish/open-chrome-tabs-in-safari.scpt
open chrome tabs in safari
var chrome = Application('Google Chrome');
var safari = Application('Safari');
safari.includeStandardAdditions = true; // Needed for openLocation()
chrome.windows[0].tabs().forEach(function (tab) {
safari.openLocation( tab.url() );
@paulirish
paulirish / open-chrome-tabs-in-safari.scpt
Created April 4, 2016 00:24
open chrome tabs in safari
tell application "Google Chrome"
set tab_list to every tab in the front window
repeat with the_tab in tab_list
set the_url to the URL of the_tab
tell application "Safari" to open location the_url
end repeat
end tell
(function(){
var p = Date.prototype;
p.val = 0;
p.add = function(num) {
this.val = num;
return this;
};
p.subtract = function(num) {
@skagedal
skagedal / underscore-pickrandom.js
Created January 31, 2012 11:22
pickRandom mixin for underscore
// underscore-pickrandom.js
// (c) 2012 Simon Kågedal Reimer
// This file is freely distributable under the MIT license.
// _.pickRandom - a mixin for underscore.js.
//
// Pick random elements from an array. Works similar to
// `_.first(_.shuffle(array, n))`, but is more efficient -- operates
// in time proportional to `n` rather than the length of the whole
// array.
// Underscore mixing for partial functions and async calls.
// Based on this microsoft post: http://msdn.microsoft.com/en-us/scriptjunkie/gg575560
_.mixin({
// Turn a normal function into an asynchronous version.
// It will return a function that expect's the last argument
// to be a callback expecting (err, result) as arguments.
wrapAsync: function(fn) {
return function() {
var args = _(arguments).toArray();
anonymous
anonymous / gist:1258555
Created October 3, 2011 06:32
Solarized Dark Theme (with sidebar and view-source colors) for Google Chrome Dev Tools
/**********************************************/
/*
/* Solarized Dark Skin by Mark Osborne - 2011
/*
/* Based on IR_Black Skin by Ben Truyman:
/* https://gist.github.com/1245727
/*
/* and Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
@rwoeber
rwoeber / local.rw.launchkeep.iterm.plist
Created July 22, 2011 10:53
Mac OS X Launch Agent to start & keep iTerm alive
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>user.launchkeep.iterm</string>
<key>KeepAlive</key>
<true/>
<key>Program</key>
<string>/Applications/iTerm.app/Contents/MacOS/iTerm</string>
@kof
kof / inherits.js
Created March 24, 2011 13:10
nodejs like utility method for inheritance
/**
* Inherit prototype properties
* @param {Function} ctor
* @param {Function} superCtor
*/
_.mixin({
inherits: (function(){
function noop(){}
function ecma3(ctor, superCtor) {
@balupton
balupton / ajaxify-html4.js
Created March 7, 2011 04:58
Ajaxify a Website using the HTML4 HashChange Functionality
(function(window,undefined){
// Prepare our Variables
var
document = window.document,
$ = window.jQuery;
// Wait for Document
$(window).bind(function(){
// Prepare Variables
@balupton
balupton / ajaxify.php
Created March 7, 2011 04:56
Ajaxify a Website with Server Side Optimisations
<?php
// Our Page Action
public function pageAction ( ) {
// Prepare our variables for our view
// ...
// Handle our view
return $this->awesomeRender('page.html');
}