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
awk 'BEGIN {srand()} {print rand() " " $0}' /usr/share/dict/words | sort | head -50 |
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
db.collection.find({ arrayWithNulls: { $elemMatch: { $type: 10 }}}); |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2371651/hack.sh | sh | |
# |
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
#!/bin/bash | |
# This script automatically sets the version and short version string of | |
# an Xcode project from the Git repository containing the project. | |
# | |
# To use this script in Xcode 4, add the contents to a "Run Script" build | |
# phase for your application target. | |
set -o errexit | |
set -o nounset |
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
;// http://www.snapengage.com/docs/asyncload.jsp | |
// usage: $.snapengage() | |
// loads snapengage asynchronously. A click on any link with class 'snapengage' | |
// will cause the chat to open. | |
!function($, window, undefined) { | |
var widgetid = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX'; | |
$.snapengage = function() { |
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(w) { | |
debugger | |
if (!w.console) { | |
var c = w.console = {}; | |
c.log = c.error = c.info = c.debug = c.warn = c.trace = c.dir = c.dirxml = c.group = c.groupEnd = c.time = c.timeEnd = c.assert = c.profile = c.profileEnd = function() {}; | |
} | |
}(window); |
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 map = function() { | |
var domain = this.info.url.match(/^https?:\/\/([^\/]*)/)[1]; | |
emit(domain, { duration: this.duration }); | |
}; | |
var reduce = function(key, values) { | |
var result = { duration: 0 }; | |
values.forEach(function(value) { | |
result.duration += value.duration | |
}); |
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
// http://stackoverflow.com/questions/2107657/mac-cocoa-getting-a-list-of-windows-using-accessibility-api | |
// http://stackoverflow.com/questions/853833/how-can-my-app-detect-a-change-to-another-apps-window | |
// http://cocoatutorial.grapewave.com/tag/axuielementcopyattributevalue/ | |
- (NSDictionary *)axInfoForProcessIdentifier:(NSNumber *)processIdentifier | |
{ | |
NSMutableDictionary *ret = [NSMutableDictionary dictionaryWithCapacity:2]; | |
pid_t pid = (pid_t) [processIdentifier integerValue]; | |
AXUIElementRef app = AXUIElementCreateApplication(pid); | |
AXUIElementRef frontWindow = nil; | |
NSString *title = 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
require 'rubygems' | |
require 'bundler/setup' | |
require 'appscript' | |
# http://stackoverflow.com/questions/480866/get-the-title-of-the-current-active-window-document-in-mac-os-x | |
while true | |
frontmost = Appscript.app('System Events').application_processes.get.select{ |a| a.frontmost.get }.first | |
if frontmost | |
puts frontmost.name.get | |
if frontmost.windows.count > 0 |