Skip to content

Instantly share code, notes, and snippets.

View schovi's full-sized avatar
👁️

David Schovanec schovi

👁️
View GitHub Profile
(defroutes core-routes
(GET "/" []
(log/info "ROOT")
"JSEM DOMA"))
(GET "/:id" [id]
(log/info "DETAIL")
(str "JSEM NA DETAILU " id))))
Setting up mongodb-10gen (2.4.7) ...
insserv: Script redis6379 is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: Script redis6379 is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
insserv: Script redis6379 is broken: incomplete LSB comment.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:' entry: please add even if empty.
root@vps:/var/lib/mongodb# /usr/bin/mongod --config /etc/mongodb.conf
Fri Oct 25 11:15:41.613 terminate() called, printing stack (if implemented for platform):
0xde0151 0x6cf3ae 0x7f2cd2fb7996 0x7f2cd2fb79c3 0x7f2cd2fb7bee 0x7f2cd300977d 0x7f2cd2fd4814 0x7f2cd2fc9744 0x7f2cd2fca77d 0xdfd9af 0xdfe2fb 0xdfafa0 0x9ee8cf 0x6dd680 0x6df429 0x7f2cd2750ead 0x6cf199
/usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0xde0151]
/usr/bin/mongod(_ZN5mongo11myterminateEv+0x3e) [0x6cf3ae]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x63996) [0x7f2cd2fb7996]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x639c3) [0x7f2cd2fb79c3]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x63bee) [0x7f2cd2fb7bee]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZSt21__throw_runtime_errorPKc+0x5d) [0x7f2cd300977d]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x80814) [0x7f2cd2fd4814]
[
{"author": "Pete Hunt", "text": "This is one comment"},
{"author": "Jordan Walke", "text": "This is *another* comment"}
]

Začnu obecným použitím angularu v aplikaci bez jakýchkoli specialit. Kód v šabloně, na který se aplikuje Angular označíme atributem ng-app. Angular pak projde celý vnitřní DOM a koná svoje. Proto není vždy výhodné dát ng-app na BODY.

Minimální ukázka Angular aplikace

<div ng-app>
  <span ng-click="hodnota = 'befeleme'">Reaguju na klik a nastavím proměnou 'hodnota'</span>
  moje proměná je {{hodnota}}
</div>
@schovi
schovi / react-footprint.js
Created March 1, 2015 18:49
React component unique footprint
// For given component/children generates uniqe footprint.
// For now it just contains type of elements and text from text nodes in plain array
// TODO: make footprint from element.type and element.props for 100% precision
var React = require('react/addons')
function makeFootprint(children) {
var result = []
return getComponentsKeys(result, children)
}
@schovi
schovi / routeState.js
Created July 16, 2015 12:01
routeState.js
import express from 'express';
const router = express.Router();
router.route('/products')
.post((req, res, next) => {
req.routeState = {
products: [
{id: 1, name: "Bike"}
]
en:
activerecord:
models:
region:
one: "Country"
other: "Countries"
image:
one: "Photo"
other: "Photos"
project_species:
import React from 'react';
const IGNORE_CLASS = 'ignore-react-onclickoutside';
export default function clickOutside(BaseComponent) {
return class ClickOutside extends React.Component {
static displayName = `${BaseComponent.name}ClickOutside`;
@schovi
schovi / index.js
Last active September 13, 2015 17:36
Require for custom extensions.
var fs = require('fs')
require.extensions['.png'] = function(require, path) {
require.exports = fs.readFileSync(path)
}
var image = require("./image.png")
// Image is Buffer