Skip to content

Instantly share code, notes, and snippets.

View dearlordylord's full-sized avatar
💭
aliens are real

Igor Loskutov dearlordylord

💭
aliens are real
View GitHub Profile
@dearlordylord
dearlordylord / graphql
Created December 29, 2020 13:05
Keystone.js blog graphql with Content field types and Cloudinary image block.
```
directive @cacheControl(
maxAge: Int
scope: CacheControlScope
) on FIELD_DEFINITION | OBJECT | INTERFACE
# A keystone list
type User {
# This virtual field will be resolved in one of the following ways (in this order):
# 1. Execution of 'labelResolver' set on the User List config, or
# 2. As an alias to the field set on 'labelField' in the User List config, or
@dearlordylord
dearlordylord / routes.js
Created April 27, 2015 09:27
Iron Router error
var A = RouteController.extend({
onBeforeAction: function() {
console.warn('A');
this.next();
}
});
var B = A.extend({
onBeforeAction: function() {
console.warn('B');
this.next();
#!/usr/bin/env bash
apt-get -y update
apt-get -y install make build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget --no-clobber ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
class ApplicationController < ActionController::Base
protect_from_forgery
def current_ability
@current_ability ||= Ability.new(current_member)
end
rescue_from CanCan::AccessDenied do |exception|
flash[:alert] = "Access Denied."
redirect_to root_url
class SessionsController < ApplicationController
def new
if member = Member.find_by_password_digest(cookies[:digest])
session[:member_id] = member.id
redirect_to (session[:ref] || root_path), :notice => "Welcome back #{member.first_name}"
end
end
def create
<h2>Log In</h2>
<%= form_tag sessions_path do %>
<div class="field">
<%= label_tag :user_name %><br>
<%= text_field_tag :user_name, params['user_name'] %>
</div>
<p></p>
<div class="field">
<%= label_tag :password %><br/>