Skip to content

Instantly share code, notes, and snippets.

View scdekov's full-sized avatar
🎯
Focusing

Svetoslav Dekov scdekov

🎯
Focusing
View GitHub Profile
#!/usr/bin/python
import sys
def get_commands():
commands = []
with open('/home/svetlio/.zsh_history') as zsh_history:
for cmd in zsh_history.read().split('\n'):
commands.append(cmd[15:])
def get_preferred_or_current_user(self, user, request_user, session_data={}):
client_system = getattr(request_user, 'client_system', None)
if not client_system:
return user
disabled_uids = self._get_disabled_uids(client_system, user)
preferred_user = self._get_preferred_from_session(client_system, session_data, user, disabled_uids)
if preferred_user:
return self._proccess_preferred_user(preferred_user)
@scdekov
scdekov / mock
Created November 21, 2017 08:44
def test_1(self, fixture1, mocker):
mocked = mocker.patch(path)
def can_rotate(time, start, end):
if time > end:
return False
return end % time <= end - start
def count_birds(times, start, end):
res = 0
for time in times:
res += int(can_rotate(time, start, end))
@scdekov
scdekov / exc
Created September 23, 2017 19:32
def can_rotate(time, start, end):
if time > end:
return 0
return end % time <= end - start
(function() {
function Entity(id, data) {
this.id = id;
}
Entity.repo = new Repository(Entity, Constants.ENTITIES_LIST_URL);
Entity.prototype._load = function(data) {
};
import React from 'react';
import SearchForm from './SearchForm.jsx';
import Results from './Results.jsx';
import io from 'socket.io-client';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {items: [], currentlyPlaying: ''};
function cls() {
this.publicFunction1 = function () {
return this._helperFunction1();
};
this._helperFunction1 = function (){};
this.publicFunction2 = function () {
return this._helperFunction2();
};
users_filterm group_filter, user_permission_filter = Q(), Q(), Q()