//
// oo0oo
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// _/`---'_
// .' \| |// '.
// / \||| : |||//
// / _||||| -:- |||||- \
This file contains hidden or 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
| const doc = context.document; | |
| const action = doc.actionsController().actionForID("MSCollapseAllGroupsAction") | |
| if (action.validate()) { | |
| action.doPerformAction(nil); | |
| } |
This file contains hidden or 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
| // Open panel | |
| var panel = NSOpenPanel.alloc().init(); | |
| [panel setCanChooseDirectories:true]; | |
| [panel setCanCreateDirectories:true]; | |
| // [panel setAllowedFileTypes:fileTypes]; | |
| //create variable to check if clicked | |
| var clicked = [panel runModal]; |
This file contains hidden or 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
| var bplist = require('bplist'); | |
| var plistBuf = new Buffer('YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMSAxIDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGarK+0AAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY=', 'base64') | |
| bplist.parseBuffer(plistBuf, function(err, result) { | |
| if (!err) | |
| console.log(result); // [{key1: ['v', 'a', 'l', 'u', 'e'], key2: 'value2'}] | |
| }); |
This file contains hidden or 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
| const fs = require('fs'); | |
| // lib to read and write to the zip | |
| const JSZip = require('jszip'); | |
| fs.readFile('Untitled3.sketch', function(err, data) { | |
| if(err) throw err; | |
| JSZip.loadAsync(data).then(function(zip) { | |
| // zip contains a json file that describes all the directory & files in the zip file |
This file contains hidden or 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
| // ---- | |
| // libsass (v3.2.5) | |
| // ---- | |
| @mixin rgba($property, $background, $opacity, $mix: white) { | |
| #{$property}: mix($background, $mix, $opacity * 100%); | |
| #{$property}: rgba($background, $opacity); | |
| @if 1 == 1 { | |
This file contains hidden or 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
| /** | |
| * sortable table plugin for jQuery | |
| * @autor - gaofeng <gfeng.peak@gmail.com> | |
| * @desc - make table sortable | |
| * @version 0.1 | |
| */ | |
| (function() { | |
| /** | |
| * Determine whether the string contains Chinese |
This file contains hidden or 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($) { | |
| // multiple plugins can go here | |
| (function(pluginName) { | |
| var defaults = { | |
| color: 'black', | |
| testFor: function(div) { | |
| return true; | |
| } | |
| }; | |
| $.fn[pluginName] = function(options) { |
This file contains hidden or 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 | |
| var sleep = function(seconds) { | |
| var start = (new Date)['getTime'](), | |
| i = 1e8; | |
| while (i--) { | |
| if ((new Date)['getTime']() - start >= seconds * 1e3) { // must be gte! | |
| return false; | |
| } | |
| } |
This file contains hidden or 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
| // 观察者模式 | |
| var observer = { | |
| addSubscriber: function (callback) { | |
| this.subscribers[this.subscribers.length] = callback; | |
| }, | |
| removeSubscriber: function (callback) { | |
| var len = this.subscribers.length, | |
| i; |
NewerOlder