This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* <canvas id="c" width="200" height="200"></canvas> */ | |
function retina(canvas, context) { | |
var ratio = window.devicePixelRatio || 1, | |
width = canvas.width, | |
height = canvas.height; | |
if (ratio > 1) { | |
canvas.width = width * ratio; | |
canvas.height = height * ratio; | |
canvas.style.width = width + "px"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SheetView.swift | |
// wrkts | |
// | |
// Created by Alexey Pegov on 28.10.14. | |
// Copyright (c) 2014 alexeypegov. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property extension_list : {"mp3"} | |
property destination_folder : (path to music folder as text) & "iTunes:iTunes Music:Automatically Add to iTunes:" | |
property this_action_path : (path to home folder as text) & "Library:Scripts:Folder Action Scripts:copy_to_itunes.scpt" | |
on adding folder items to this_folder after receiving added_items | |
set number_of_items to 0 | |
repeat with i from 1 to number of items in added_items | |
set this_file to item i of added_items | |
if folder of (info for this_file) is true then | |
tell application "System Events" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* todo *) | |
(* trim & validate selected text ^[a-zA-Z]+\-[0-9]+$ *) | |
(* change menu name to "Open [Selected issue id] in YouTrack" *) | |
(* multiple browsers support? *) | |
property theURL : "" | |
on run {input, parameters} | |
tell application "Google Chrome" | |
activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
/** | |
* Disposer jQuery plugin. | |
* | |
* Adds 'disposed' event so you may execute some code _before_ element is somehow removed: | |
* | |
* $('.remove').bind('disposed', function() { | |
* // code to be executed | |
* }); | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: $.initinput(); $.inputmap("pressed LEFT", function() { alert('pressed LEFT') }, null); | |
// or: $('div').inputmap("pressed ESCAPE", function() { alert('pressed ESCAPE') }); | |
// with $.install_esc_handler() you popups will be closed by ESCAPE. Popups are elements with 'popup' class and 'z-index' > 0 | |
$.extend({ | |
keyCodes:{8:'BACKSPACE', 9:'TAB', 13:'ENTER', 16:'SHIFT', 17:'CONTROL', 18:'ALT', 27:'ESCAPE', | |
33:'PG_UP', 34:'PG_DN', 35:'END', 36:'HOME', 37:'LEFT', 38:'UP', 39:'RIGHT', 40:'DOWN', | |
46:'DELETE', 91:'META', 0:'UNKNOWN'}, | |
repeatKeys:[ 37, 38, 39, 40 ], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: _('#id.class1.class2[data-b=b]', 'test') -> <div id="id" class="class1 class2" data-b="b">test</div> | |
// or: _('a.link', {href: 'http://www.example.com'}, 'Click me') -> <a class="link" href="http://www.example.com">Click me</a> | |
_ = function(text, content_or_attrs, content) { | |
var result = "", id = false, cls = false, p = false, tag = false; | |
var b = ""; | |
for (var i = 0; i < text.length; i++) { | |
var ch = text.charAt(i); | |
if (ch == '#' && !p) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple observer (pubsub) implementation | |
define(["underscore", "base/classex", "util/logging"], function(_, Class, Logging) { | |
var PubSub = Class.extend({}); | |
PubSub._topics = function() { | |
if (!window.pubsub) { | |
window.pubsub = {}; | |
} | |
return window.pubsub; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(["class", "pubsub"], function(Class, Pubsub) { | |
var BrowserUtil = Class.extend({ | |
init: function() { | |
var blur = function onBlur() { | |
document.body.className = 'blurred'; | |
Pubsub.publish("window:blurred") | |
}; | |
var gain = function onFocus(){ | |
document.body.className = 'focused'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Upload.initDnD = function () { | |
var d = $(document)[0]; | |
d.ondragenter = function (event) { | |
event.preventDefault(); | |
if (!window.drag_in_progress) { | |
window.drag_in_progress = true; | |
var drop = $(h('.drop', h('.text', 'Drop it to upload'))); | |
$('body').append(drop); |
OlderNewer