/* this is the theme used to style the syntax highlighting on this page! */
code {
font-family: "Lucida Console", "Monaco", monospace;
}
pre {
color: #fff;
font-size: 23px;
background: #000;
padding: 10px;
line-height: 25px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
word-wrap: break-word;
margin-bottom: 15px;
}
code span {
-moz-transition: color .8s ease-in;
-o-transition: color .8s ease-in;
-webkit-transition: color .8s ease-in;
transition: color .8s ease-in;
}
.animate {
color: #fff !important;
}
.red {
color: #f50419;
}
.orange {
color: #f57900;
}
.yellow {
color: #f5e600;
}
.green {
color: #00f50c;
}
.blue {
color: #0081f5;
}
.indigo {
color: #5000f5;
}
.violet {
color: #7d05f5;
}
.comment {
color: #223576;
}
.javascript .comment {
color: #535353;
}
.meta, .entity {
color: #f03200;
}
.support {
color: #006dcf;
}
.string {
color: #00f50c;
}
.string.regexp {
color: #fff;
}
.support.attribute, .support.css-property, .support.regex.modifier {
color: #0087ff;
}
.support.value {
color: #1bbbcf;
}
.integer, .constant {
color: #d8fa3c;
}
.keyword, .selector, .storage {
color: #fbde2d;
}
.constant.regex.escape {
color: #d8fa3c;
}
# -*- coding: Windows-1251 -*-
'''
getenv_system.py
Get SYSTEM environment value, as if running under Service or SYSTEM account
Author: Denis Barmenkov
Copyright: this code is free, but if you want to use it,
please keep this multiline comment along with function source.
Thank you.
2006-01-28 15:30
'''
import os, win32api, win32con
def getenv_system(varname, default=''):
v = default
try:
rkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, 'SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment')
try:
v = str(win32api.RegQueryValueEx(rkey, varname)[0])
v = win32api.ExpandEnvironmentStrings(v)
except:
pass
finally:
win32api.RegCloseKey(rkey)
return v
print 'SYSTEM.TEMP => %s' % getenv_system('NODE_PATH')
print 'USER.TEMP => %s' % os.getenv('TEMP')
//this is a comment
$(document).ready(function() {
function showHiddenParagraphs() { // Another comment
$("p.hidden").fadeIn(500);
}
setTimeout(showHiddenParagraphs, 1000);
});
/*
TrafficCop - ?
Author: Jim Cowart
Site: http://freshbrewedcode.com/jimcowart/2011/11/25/traffic-cop/
License: Dual licensed MIT (http://www.opensource.org/licenses/mit-license) & GPL (http://www.opensource.org/licenses/gpl-license)
Version 0.1.0
*/
(function($, undefined) {
var inProgress = {};
$.trafficCop = function(url, options) {
var reqOptions = url, key;
if(arguments.length === 2) {
reqOptions = $.extend(true, options, { url: url });
}
key = JSON.stringify(reqOptions);
if(inProgress[key]) {
inProgress[key].successCallbacks.push(reqOptions.success);
inProgress[key].errorCallbacks.push(reqOptions.error);
return;
}
var remove = function() {
delete inProgress[key];
},
traffic = {
successCallbacks: [reqOptions.success],
errorCallbacks: [reqOptions.error],
success: function() {
var args = arguments;
$.each($(inProgress[key].successCallbacks), function(idx,item){ item.apply(null, args); });
remove();
},
error: function() {
var args = arguments;
$.each($(inProgress[key].errorCallbacks), function(idx,item){ item.apply(null, args); });
remove();
}
};
inProgress[key] = $.extend(true, {}, reqOptions, traffic);
return $.ajax(inProgress[key]);
};
})(jQuery);
/* Title: switch Pattern
Description: improve the readability and robustness of your switch statements
*/
/* Style conventions:
* 1. Aligning each `case` with `switch` (an exception to the curly braces indentation rule).
* 2. Indenting the code within each case.
* 3. Ending each `case` with a clear `break`;.
* 4. Avoiding fall-throughs (when you omit the break intentionally). If you're absolutely convinced
* that a fall-through is the best approach, make sure you document such cases, because they might
* look like errors to the readers of your code.
* 5. Ending the `switch` with a `default`: to make sure there's always a sane result even if none of
* the cases matched.
*/
var inspect_me = 0, result = '';
switch (inspect_me) {
case 0:
result = "zero";
break;
case 1:
result = "one";
break;
default:
result = "unknown";
}
/* Title: Callback patterns
Description: when you pass function A to function B as a parameter, function A is a callback function
*/
var complexComputation = function () { /* do some complex stuff and return a node */
};
var findNodes = function (callback) {
var nodes = [];
var node = complexComputation();
// call if callback is callable
if (typeof callback === "function") {
callback(node);
}
nodes.push(node);
return nodes;
};
// a callback function
var hide = function (node) {
node.style.display = "none";
};
// find the nodes and hide them as you go
var hiddenNodes = findNodes(hide);
// you can also use an anonymous function, like this:
var blockNodes = findNodes(function (node) {
node.style.display = 'block';
});
// reference
// http://www.jspatterns.com/
// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate
*/
/*
*/