Skip to content

Instantly share code, notes, and snippets.

View viktor-evdokimov's full-sized avatar
👷‍♂️
Focusing

Viktor Evdokimov viktor-evdokimov

👷‍♂️
Focusing
View GitHub Profile
@vojtajina
vojtajina / angular-eventBus.js
Created July 30, 2011 13:41
Angular $eventBus
// 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);
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
);
@blockjon
blockjon / gist:5662740
Last active December 17, 2015 19:49
What sql query will produce the results set below using just a single table scan?
What sql query will produce the results set below using just a single table scan?
animals
-----------------
| size | color |
-----------------
| big | red |
| small | red |
| small | green |
-----------------
@waylaidwanderer
waylaidwanderer / ScrapUserHandler.cs
Last active December 19, 2015 11:38
Scrapbanking bot written by http://steamcommunity.com/id/waylaidwanderer/ - coded using SteamBot wrapper (https://github.com/Jessecar96/SteamBot)THERE IS NO SUPPORT FOR THIS USERHANDLER. This code is outdated, may be exploitable, and should only be used as a guideline. Use at your own personal risk.
using SteamKit2;
using SteamTrade;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Timers;
namespace SteamBot
{
public class ScrapUserHandler : UserHandler
@Jach
Jach / mig.py
Created December 30, 2011 04:09
Dirty migration script from Jira issues to Github issues
'''
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
@w495
w495 / test_concat.erl
Created June 13, 2012 15:43
Тестирование скорости конкатенации
%%
%% @file test_concat.erl тестирование скорости конкатенации
%% Тестирование проводилось на списках и binary.
%% Тестировалось наивная конкатенация через:
%% * ++, для списков;
%% * <<X/binary,Y/binary>>>, для binary;
%% * вложенные списки (правильные и неправильные), cм ниже;
%% * конкатенация через lists:append, для списков;
%% * конкатенация через string:join, для списков;
%%
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"}'
"""
@ttsiodras
ttsiodras / hack.py
Last active August 21, 2017 09:48
I just did something that depending on your viewpoint on coding, is either an insult to God and humanity, or absolutely brilliant.
#
# 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?
#
@dieseltravis
dieseltravis / changeset.bat
Created April 27, 2011 17:14
get changed files from TFS
@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
@viktor-evdokimov
viktor-evdokimov / Untitled-3
Last active April 5, 2018 23:26
return which shell is used
# return which shell is used
> echo $0
-zsh