Skip to content

Instantly share code, notes, and snippets.

View reebalazs's full-sized avatar

Balázs Reé reebalazs

View GitHub Profile
async function fetchData() {
let response;
try {
response = await request(options);
} catch (exc) {
// ... do something with the error
}
// ... do something with the response
@reebalazs
reebalazs / .babelrc
Created November 12, 2015 14:12
babelrc
{
stage: 0,
optional: [
"runtime"
]
}
@reebalazs
reebalazs / webpack.config.js
Last active November 12, 2015 14:15
babel does not load mypackage
var path = require('path');
var include = [
path.resolve(path.join(__dirname, 'src')),
/// path.join(__dirname, '..', '..', '..', 'src'),
path.resolve(path.join(__dirname, 'node_modules', 'nucleus', 'src'))
];
module.exports = {
hot: false,
/**
* Wait until the test condition is true or a timeout occurs. Useful for waiting
* on a server response or for a ui change (fadeIn, etc.) to occur.
*
* @param testFx javascript condition that evaluates to a boolean,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
* @param onReady what to do when testFx condition is fulfilled,
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or
* as a callback function.
@reebalazs
reebalazs / karma-spec.js
Last active August 29, 2015 14:07
Karma unit testing AngularJS submodules with config(), run()
// DRAFT, UNTESTED
// Originally you have an Angular app that
// is decomposed to submodules. Each submodule has its own
// config and run handlers. One submodule (lib3)
// also depends on another submodule.
module('myapp', ['lib1', 'lib2', 'lib3'])
.config(...)
class MyFolderContentsTable(...):
def reorderedContent(self, *args, **kw):
var original_items = super(self, MyFolderContentsTable).contentsMethod()(*args, **kw)
# ... sort them differently
items = ...
return items

TinyMCE setting initial content from js

It's better to set initial content directly on the DOM instead of editor.setContent(), because the latter one will fail before the editor has completely been set up.

A Pen by Balazs Ree on CodePen.

License.

@reebalazs
reebalazs / buildout.cfg
Created March 17, 2014 08:04
MacOSX problem after OSX update, Pillow
[environment]
recipe = collective.recipe.environment
# MacOSX problem, https://twistedmatrix.com/trac/ticket/6974#comment:12
ARCHFLAGS = -Wno-error=unused-command-line-argument-hard-error-in-future
@reebalazs
reebalazs / .pdbrc
Created November 25, 2013 13:15
.pdbrc working with ipdb and PdbSublimeTextSupport
from PdbSublimeTextSupport import preloop, precmd
pdb.Pdb.preloop = preloop
pdb.Pdb.precmd = precmd
try:
from ipdb.__main__ import Pdb as ipdb_Pdb
except ImportError:
pass
else: