Skip to content

Instantly share code, notes, and snippets.

View lexfrl's full-sized avatar
🇦🇷

Alexey lexfrl

🇦🇷
View GitHub Profile
(ns routes
(:require [clojure.string :as str]))
(def index)
(def users-show)
(def user-activate)
(def user-details "test")
(def users-list)
(def user-new)
(def comment-show)
{
number-param1
[ // and
[
[> $min],
[= 0]
] // or
[
[< $max]
]
let
VM117:2 Uncaught ReferenceError: let is not defined
at <anonymous>:2:1
at Object.InjectedScript._evaluateOn (<anonymous>:887:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:820:34)
at Object.InjectedScript.evaluate (<anonymous>:694:21)(anonymous function) @ VM117:2InjectedScript._evaluateOn @ VM104:887InjectedScript._evaluateAndWrap @ VM104:820InjectedScript.evaluate @ VM104:694
let a = 10;
VM152:2 Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at Object.InjectedScript._evaluateOn (<anonymous>:887:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:820:34)
<script dangerouslySetInnerHTML={{__html: `
window.fbAsyncInit = function() {
FB.init({
appId : 'your-app-id',
xfbml : true,
version : 'v2.3'
});
};
(function(d, s, id){
@lexfrl
lexfrl / friends
Last active August 29, 2015 14:21
import { fbAccessToken } from "../config.js"
import assert from "assert";
import vkontakte from "vkontakte";
import Promise from "bluebird";
const join = Promise.join;
export default {
name: "users",
➜ gifter git:(master) ✗ http GET 'ggifster.ru/api/gifts;from=a&to=b'
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 109
Content-Type: application/json; charset=utf-8
Date: Tue, 19 May 2015 12:50:32 GMT
ETag: W/"6d-b75e774"
Vary: Accept-Encoding
X-Powered-By: Express
import Router from "../router";
describe('Router', () => {
const router = new Router(require('./data/routes'));
it('should match correct route name', () => {
expect(router.match('http://example.com/users/1/comments').name).toBe('users.comments');
expect(router.match('http://example.com/users').name).toBe('users');
});
it('should match correct route name even with slashes', () => {
@lexfrl
lexfrl / rules.js
Last active August 29, 2015 14:22
import r from "superagent-bluebird-promise";
import router from "./router";
export default {
"request": (req, context) => {
let route = router.match(req.url);
return context.set("route", route);
},
"route": (route, context) => {
let {name, params: { id }} = route;
import rules from "./rules";
import Solver from "solvr";
import im from "immutable";
class MySolver extends Solver {
get(path) {
path = Solver.path(path);
if (path.join(".") === "user") {
return this.oneOf(["users"]);
}
static getMapPaths(map) {
map = new Map(map);
getPaths = (map, result = new List([])) => {
if (!Map.isMap(map)) {
return result;
}
return map.flip().toList().reduce((res, k) => {
return res.push(getPaths((map.get(k)), result.push(k)));
}, new List());
};