Skip to content

Instantly share code, notes, and snippets.

View devoto13's full-sized avatar

Yaroslav Admin devoto13

View GitHub Profile
@devoto13
devoto13 / items.py
Created November 23, 2015 13:22
Unexpected items from France24
{'authors': [{'biography': {'body': '',
'changed': '',
'created': '',
'images': {'alt': '',
'caption': '',
'credit': '',
'formats': [{'code': 'original',
'url': 'http://scd.france24.com/en/files/author_pictures/francois_picard.jpg'}],
'infos_title': '',
'url': ''},
@devoto13
devoto13 / sa.py
Created November 24, 2015 11:22
SQLAlchemy boilerplate for experiments
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
# Define models here
engine = create_engine('sqlite:///:memory:', echo=True)
In [2]: class Test(object):
def __setattr__(self, name, value):
print(name, "changed to", value)
super().__setattr__(name, value)
...:
In [3]: t = Test()
In [4]: t.name = 4
name changed to 4
@devoto13
devoto13 / TypeScript Indent.tmPreferences
Last active October 27, 2016 16:37
Fixed indentation preferences for TypeScript
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>TypeScript Indent</string>
<key>scope</key>
<string>source.ts, source.tsx</string>
<key>settings</key>
<dict>
{"seq":0,"type":"response","command":"ideChangeFiles","request_seq":36,"success":true,"body":"done"}
{"seq":0,"type":"response","command":"ideGetErr","request_seq":37,"success":true,"body":{"infos":[{"file":"/Users/devoto13/Softwerk/SD10/Projects/devapp/src/app/shared/toaster/toaster.service.ts","diagnostics":[]}]}}
{"seq":0,"type":"response","command":"ideChangeFiles","request_seq":38,"success":true,"body":"done"}
{"seq":0,"type":"response","command":"ideCompletions","request_seq":39,"success":true,"body":[{"name":"applicationRef","kindModifiers":"private","kind":"property","displayParts":[{"text":"(","kind":"punctuation"},{"text":"property","kind":"text"},{"text":")","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"ToasterService","kind":"className"},{"text":".","kind":"punctuation"},{"text":"applicationRef","kind":"propertyName"},{"text":":","kind":"punctuation"},{"text":" ","kind":"space"},{"text":"ApplicationRef","kind":"aliasName"}],"documentation":[],"sortText":"0"},{"name":"componentFactoryR
@devoto13
devoto13 / test.js
Last active February 5, 2017 11:56
Demo that Mocha handles Promise returned from the test correctly
// It demonstrates, that instead of explicitly adding `done()` callbacks everywhere you can return Promise from method.
//
// Expected output:
// $ ./node_modules/.bin/_mocha test.js
//
//
// tide retriever
// 1) should retrieve and parse tide CSV data
// 2) should retrieve and parse tide CSV data
//
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is based on the javascript.lang file of GtkSourceView.
It has additional Typescript keywords defined.
Author: Johannes Bergmann
Copyright (C) 2014 Johannes Bergmann
###
@devoto13
devoto13 / devoto13.xml
Last active March 29, 2017 22:09
Style for GTKSourceView 3 similar to light theme of WebStorm
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of GtkSourceView
Copyright (C) 2006-2007 GtkSourceView team
Author: Yevgen Muntyan <[email protected]>
GtkSourceView is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
$ yarn list
yarn list v1.1.0
├─ @types/[email protected]
│ └─ @types/node@*
├─ @types/[email protected]
│ ├─ @types/minimatch@*
│ ├─ @types/[email protected]
│ └─ @types/node@*
├─ @types/[email protected]
├─ @types/[email protected]
@devoto13
devoto13 / custom-event-manager.ts
Created January 20, 2018 10:36
EventManager, which allows to subscribe to any event outside of NgZone, so event won't trigger change detection
/**
* Custom event manager, which allows to add event listeners outside of Angular
* zone.
*
* See https://stackoverflow.com/a/45229997/1377864 for original idea
*/
@Injectable()
export class CustomEventManager extends EventManager {
addGlobalEventListener(target: string, eventName: string, handler: Function): Function {
if (eventName.endsWith(NO_ZONE)) {