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
// pseudocode | |
angular.service('$eventBus', function() { | |
var listeners = {}; | |
var mainBus = function(scope) { | |
return new ChildBus(mainBus, scope); | |
}; | |
mainBus.emit = function(type) { | |
var args = Array.prototype.slice.call(arguments, 1); |
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
notification : function(sUrl, sTitle, sContent, onDisplay, onClick, onClose) | |
{ | |
if(window.webkitNotifications) { // Test si webkitNotifications de Chrome | |
if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED | |
var notif = window.webkitNotifications.createNotification( | |
sUrl, // icon url - can be relative | |
sTitle, // notification title | |
sContent // notification body text | |
); |
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
What sql query will produce the results set below using just a single table scan? | |
animals | |
----------------- | |
| size | color | | |
----------------- | |
| big | red | | |
| small | red | | |
| small | green | | |
----------------- |
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
using SteamKit2; | |
using SteamTrade; | |
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Timers; | |
namespace SteamBot | |
{ | |
public class ScrapUserHandler : UserHandler |
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
''' | |
Steps: | |
1. Create any milestones | |
2. Create any labels | |
3. Create each issue, linking them to milestones and labels | |
3.1: Update status for new issue if closed | |
4: Create all the comments for each issue | |
''' | |
import getpass | |
import json |
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
%% | |
%% @file test_concat.erl тестирование скорости конкатенации | |
%% Тестирование проводилось на списках и binary. | |
%% Тестировалось наивная конкатенация через: | |
%% * ++, для списков; | |
%% * <<X/binary,Y/binary>>>, для binary; | |
%% * вложенные списки (правильные и неправильные), cм ниже; | |
%% * конкатенация через lists:append, для списков; | |
%% * конкатенация через string:join, для списков; | |
%% |
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
import simplejson as json | |
import lxml | |
class objectJSONEncoder(json.JSONEncoder): | |
"""A specialized JSON encoder that can handle simple lxml objectify types | |
>>> from lxml import objectify | |
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>") | |
>>> objectJSONEncoder().encode(obj) | |
'{"price": 1.5, "author": "W. Shakespeare"}' | |
""" |
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
# | |
# I inherited a large code base, where hundreds of code paths end up | |
# calling "common_function_called_in_gazillion_places". | |
# | |
# And the need arose for this function to access the HTTP request's | |
# headers... | |
# | |
# What to do? Refactor all the places leading up to here? In a dynamically | |
# typed language, with no compiler to tell us the places to refactor? | |
# |
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
@echo off | |
SET tfs=http://YOUR_TFS_SERVER:8080/ | |
:number | |
ECHO Enter changeset number (0 to exit): | |
SET /p chg= | |
IF NOT %chg% GTR 0 GOTO end | |
"%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe" changeset /server:%tfs% %chg% /noprompt | |
GOTO number | |
:end |
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
# return which shell is used | |
> echo $0 | |
-zsh |
OlderNewer