Skip to content

Instantly share code, notes, and snippets.

@kaievns
kaievns / gist:acb23149b66418ba340c
Created July 29, 2014 00:44
How to populate PostgreSQL with dummy data
CREATE TABLE t_random AS SELECT s, md5(random()::text) FROM generate_Series(1,5) s;
INSERT INTO t_random VALUES (generate_series(1,1000000000), md5(random()::text));
SELECT pg_size_pretty(pg_relation_size('t_random'));
@kaievns
kaievns / gist:2fb484feb3e55c1ac439
Created September 30, 2014 00:59
Random hex of arbitrary size in javascript
function random_hex(size) {
return Array.apply(null, Array(size)).map(function() {
return (Math.random()*16|0).toString(16);
}).join("");
}
console.log(random_hex(128));
@kaievns
kaievns / gist:cfd2e68d5ce856ec8adf
Created October 8, 2014 11:34
BD Wishlist 2014
Wetsuit, size M/MT (height 182cm, weight 77kg), thickness 3/2mm, colors black/red/yellow
Climbing shoes (size 44.5)
Manly surfing school
Longboard, mini cruiser skateboard (not a penny board), something with a kicktail, ~27" long, something like this one http://i.ebayimg.com/00/s/NTA0WDUwNA==/z/QD0AAMXQ1d1TGjaH/$_12.JPG
Cheezburger
@kaievns
kaievns / awesome-cursor.less
Created March 18, 2015 22:37
Awesome cursor for atom editor
atom-text-editor.is-focused::shadow .cursors {
.cursor {
transition: opacity .2s ease-out;
opacity: 0.7;
background: gray;
border: none;
border-radius: 1px;
}
&.blink-off .cursor {
@kaievns
kaievns / gist:568c5019aa0fb2f74305
Last active September 17, 2015 07:02
Wishlist 2015
- TC electronics ditto looper (mini)
- TC electronics hall of fame mini
- Ibanes tube screamer mini
- addict a ball http://www.addictaball.com.au
- fitbit hr large black
const connect = (mapStateToProps, mapDispatchToProps) => magic ...
const MegaLopolos = (props) =>
<div>
Stuff....
</div>
export defaults connect(mapStateToProps, mapDispatchToProps)(cssModules(styles)(MegaLopolos));
@kaievns
kaievns / index.html
Created December 7, 2017 04:37
blog post
<form action="/signin">
<input type="text" name="username" />
<input type="password" name="password" />
<button type="submit">Sign In</button>
</form>
@kaievns
kaievns / index.jsx
Last active December 7, 2017 05:40
import { Form, TextInput, PasswordInput } from 'a-plus-forms';
const signIn = ({ username, password }) =>
axios.post('/users', { username, password });
<Form onSubmit={signIn}>
<TextInput name="username" label="Username" />
<PasswordInput name="password" label="Password" />
<button type="submit">Sign In</button>
</Form>
import { field, TextInput } from 'a-plus-forms';
@field()
class PhoneInput extends React.Component {
onChange = (text) => {
const phoneNumber = format(text); // to phone number
this.props.onChange(phoneNumber);
}
render() {
import { mount } from 'enzyme';
import { TextInput, PasswordInput } from 'a-plus-forms';
import SignInForm from 'src/features/auth/signin_form';
describe('<SignInForm /', () => {
it('works beautifully', () => {
const onSubmit = sinon.spy();
const wrapper = mount(<SignInForm onSubmit={onSubmit} />);
wrapper.find(TextInput).instance().value = 'nikolay';