Skip to content

Instantly share code, notes, and snippets.

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 === "";
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.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");
});
});
});
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
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
@qoobaa
qoobaa / NBP.sql
Last active August 29, 2015 13:57
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));
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
/usr/lib
└─┬ npm@1.3.21
├── abbrev@1.0.4
├── ansi@0.2.1
├── ansicolors@0.3.2
├── ansistyles@0.1.3
├── archy@0.0.2
├── block-stream@0.0.7
├── child-process-close@0.1.1
├── chmodr@0.1.0
sar@0.1.1 /home/kuba/Projects/sarkmsjs
├─┬ bower@1.2.8
│ ├── abbrev@1.0.4
│ ├── archy@0.0.2
│ ├─┬ bower-config@0.5.0
│ │ ├── mout@0.6.0
│ │ └─┬ optimist@0.6.0
│ │ ├── minimist@0.0.5
│ │ └── wordwrap@0.0.2
│ ├── bower-endpoint-parser@0.2.1
@qoobaa
qoobaa / numbers.js
Last active December 26, 2015 02:49
var count = 2,
people = [{
name: "Joe",
age: 44,
updatedAt: 1382351154540
},
{
name: "Alice",
age: 37,
updatedAt: 1382351205213