This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from "ember"; | |
const Proxy = Ember.Object.extend({ | |
init() { | |
this.set("errors", []); | |
}, | |
isEmpty() { | |
const value = this.get("value"); | |
const result = value === null && value === undefined && value === ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"); | |
function decode(encoded) { | |
var path = []; | |
for (var i = 0, j = 0, n = [0, 0]; i < encoded.length; i++) { | |
var k = encoded.charCodeAt(i) - 0x30; | |
n[j] = (n[j] << 5) | k & 0x1f; | |
if ((k & 0x20)) { | |
n[j] = ((n[j] & 0x01) ? (~(n[j] >> 1)) : (n[j] >> 1)) * 1e-7; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.resource("restaurants", function () { | |
this.resource("restaurant", { path: "/:restaurant_id" }, function () { | |
this.route("show", { path: "/" }); | |
this.resource("bookings", function () { | |
this.route("new"); | |
this.resource("booking", { path: "/:booking_id" }, function () { | |
this.route("show"); | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
ROLES = %w[admin manager client] | |
validates :role, inclusion: {in: ROLES} | |
def role | |
ActiveSupport::StringInquirer.new(self[:role].to_s) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class V1::Client::SessionsController < V1::Client::ApplicationController | |
skip_before_action :authenticate, only: %i[create] | |
def create | |
@session = ::Client::Session.new(session_params) | |
@session.save | |
respond_with @session, location: nil | |
end | |
private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE "https://raw.github.com/cowbell/yql-tables/master/nbp/nbp.dir.xml"; | |
USE "https://raw.github.com/cowbell/yql-tables/master/nbp/nbp.tables.xml"; | |
SELECT * FROM nbp.tables WHERE id IN | |
(SELECT id FROM nbp.dir WHERE typ = 'A' AND data_publikacji < '2014-03-01' | |
| SORT(field='data_publikacji') | |
| TAIL(count=1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TestUser | |
class User < SimpleDelegator | |
include Rails.application.routes.url_helpers | |
include FactoryGirl::Syntax::Methods | |
Capybara::Session::DSL_METHODS.each do |method| | |
define_method method do |*args, &block| | |
@session.send method, *args, &block | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/lib | |
└─┬ [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] | |
├── [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected] /home/kuba/Projects/sarkmsjs | |
├─┬ [email protected] | |
│ ├── [email protected] | |
│ ├── [email protected] | |
│ ├─┬ [email protected] | |
│ │ ├── [email protected] | |
│ │ └─┬ [email protected] | |
│ │ ├── [email protected] | |
│ │ └── [email protected] | |
│ ├── [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var count = 2, | |
people = [{ | |
name: "Joe", | |
age: 44, | |
updatedAt: 1382351154540 | |
}, | |
{ | |
name: "Alice", | |
age: 37, | |
updatedAt: 1382351205213 |