Skip to content

Instantly share code, notes, and snippets.

View abelaska's full-sized avatar
👍

Alois Bělaška abelaska

👍
View GitHub Profile
#!/bin/bash
set -e
# SET HOSTNAME
oldname=$(hostname)
hostname "$1"
sed -i -e s/$oldname/"$1"/g /etc/hosts
sed -i -e s/$oldname/"$1"/g /etc/sysconfig/network
@abelaska
abelaska / gist:b1a4f7eb40b17584a119
Created November 5, 2015 16:36
Trying to use react-toolbox in isomorphic app
Tring to integrate react-toolbox into https://github.com/este/este I am getting this error:
/home/abelaska/Projects/ten-app/node_modules/react-transform-hmr/lib/index.js:51
throw new Error('locals[0] does not appear to be a `module` object with Hot Module ' + 'replacement API enabled. You should disable react-transform-hmr in ' + 'production by using `env` section in Babel configuration. See the ' + 'example in README: https://github.com/gaearon/react-transform-hmr');
^
Error: locals[0] does not appear to be a `module` object with Hot Module replacement API enabled. You should disable react-transform-hmr in production by using `env` section in Babel configuration. See the example in README: https://github.com/gaearon/react-transform-hmr
at proxyReactComponents (/home/abelaska/Projects/ten-app/node_modules/react-transform-hmr/lib/index.js:51:11)
at Object.<anonymous> (/home/abelaska/Projects/ten-app/node_modules/react-toolbox/lib/input/index.js:47:65)
at Module._compile (module.js:435:26)
@abelaska
abelaska / gist:6a4d8d4da37595e03303e666090f76d9
Created August 31, 2016 07:23
Primitive inline styling
const compileStyles = defaultStyles => (...stylePaths) => {
const styles = stylePaths.map(stylePath => {
const path = `${stylePath}.style`
const style = get(defaultStyles, path);
if (!style) {
throw new Error(`Style path ${path} not found`);
}
return style;
});
return Object.assign({}, ...styles);
@abelaska
abelaska / gist:9c9eda70d31315f27a564be2ee490cf4
Created September 9, 2016 08:57
CSS Roboto Embedded Font Base64 encoded
/* https://fonts.google.com/specimen/Roboto?selection.family=Roboto:300,400,500,700 https://www.fontsquirrel.com/tools/webfont-generator */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAGSwABMAAAAAtfwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABqAAAABwAAAAcZSXU3EdERUYAAAHEAAAAlQAAAOYXGhVYR1BPUwAAAlwAAAdrAAAQ5noXPxxHU1VCAAAJyAAAATQAAAKy3SOq409TLzIAAAr8AAAAUwAAAGCgNqyhY21hcAAAC1AAAAGPAAAB6gODigBjdnQgAAAM4AAAAEIAAABCEToKw2ZwZ20AAA0kAAABsQAAAmVTtC+nZ2FzcAAADtgAAAAIAAAACAAAABBnbHlmAAAO4AAATFsAAIy8VrEAaGhlYWQAAFs8AAAAMwAAADYN24w7aGhlYQAAW3AAAAAgAAAAJA8tBb1obXR4AABbkAAAAnoAAAOqnWlWT2xvY2EAAF4MAAAByQAAAdgbwD2ObWF4cAAAX9gAAAAgAAAAIAIIAaduYW1lAABf+AAAAc0AAAPGOTyS+XBvc3QAAGHIAAAB8gAAAu/ZWLW+cHJlcAAAY7wAAADqAAABofgPHd13ZWJmAABkqAAAAAYAAAAGcF9X0gAAAAEAAAAAzD2izwAAAADE8BEuAAAAANP4IN542h3P2UoCYBBA4fP/eO1D+KiVCppaKC64laaCuaK44NqLdJngU3RqDgPfXA4BSLrf/E0kReDBfeTJK22BjEWy5HSeZ12gqEu86FfKukJV1yxQt0iDpm7R1h26+s0i7/R0nw89sMDQIiPG+p
try {
await UserSession.get(ctx.id).update({ pingedAt: r.now() }, { durability: 'soft' });
} catch (e) {
if (e.name === 'DocumentNotFoundError') {
await UserSession
.insert({ id: ctx.id, userId: ctx.user.id, pingedAt: r.now() }, { durability: 'soft' });
} else {
log.error(`Failed to update user session ${ctx.id}`, {
error: err
});
https://github.com/paralect/robomongo/issues/1106
const show = ({ url }, resolve, reject) => {
const width = Math.max(1000, Math.floor(window.outerWidth * 0.8));
const height = Math.max(630, Math.floor(window.outerHeight * 0.5));
const left = Math.floor(window.screenX + (window.outerWidth - width) / 2);
const top = Math.floor(window.screenY + (window.outerHeight - height) / 8);
const wOptions = [
'toolbar=0',
'scrollbars=1',
'status=0',
@abelaska
abelaska / editable.js
Last active June 23, 2018 08:16
React Inline contenteditable
// @flow
/* global document */
export default ({
onCommit,
maxLength = -1,
state = {}
}: {
state?: {
originalValue?: string
@abelaska
abelaska / google-img-resize.mdown
Last active August 12, 2020 05:50
Google’s authentication-less on-the-fly image resizing service

Google's authentication-less on-the-fly image resizing service

I found it while poking around the Google+ HTML. Jotting down some notes felt like a good idea, so here goes. If you know more about this API, let me know, please!

(Word of warning: I spent ~30 minutes on both my experimentation and this here write-up, so it might not be the most thought-provoking, brilliant thing you read today.)