This file contains 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
-- List all existing indexes and include some useful info about them (incl. the index's definition) | |
SELECT | |
schemaname AS schemaname, | |
t.relname AS tablename, | |
ix.relname AS indexname, | |
regexp_replace(pg_get_indexdef(i.indexrelid), '^[^\(]*\((.*)\)$', '\1') AS columns, | |
regexp_replace(pg_get_indexdef(i.indexrelid), '.* USING ([^ ]*) \(.*', '\1') AS algorithm, | |
indisunique AS UNIQUE, | |
indisprimary AS PRIMARY, |
This file contains 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 { Controller } from "stimulus" | |
import Inputmask from 'inputmask'; | |
export default class extends Controller { | |
static targets = ['employees', 'amount', 'fullresult', 'result', 'economy', 'resultContent', 'calculator', 'id', 'emailBtn', 'leadBtn'] | |
connect(){ | |
this.params = ['employees', 'amount', 'fullresult', 'result', 'economy', 'id'] | |
var _component = this | |
this.state = 'valid' | |
var im = new Inputmask('999,99') |
This file contains 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
export default class BaseValidator { | |
constructor(value, options, errorMessages) { | |
this.value = value | |
this.options = options | |
this.errorMessages = errorMessages | |
} | |
validate() { | |
return { valid: false, message: 'Implement me!'} | |
} |
This file contains 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
div data-controller='tabs' data-tabs-index='1' | |
.tabs.is-boxed.is-marginless | |
ul | |
li data-target='tabs.tab' | |
a data={action: "tabs#change"} Tab 1 | |
li data-target='tabs.tab' | |
a data={action: "tabs#change"} Tab 2 | |
.tab.box data={target: 'tabs.tabPanel'} Tab panel 1 | |
.tab.box data={target: 'tabs.tabPanel'} Tab panel 2 |
This file contains 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 { Controller } from 'stimulus'; | |
export default class extends Controller { | |
onInput = (e) => this.updateHiddenInput(e.target.value); | |
connect() { | |
this.element.addEventListener('input', this.onInput); | |
this.initializeHiddenInput(); | |
this.initializeInput(); | |
} |
This file contains 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 module defines a class method called "descendants" that will return a | |
# list of all classes that inherit from the current class. | |
# | |
# Array.descendants | |
# Hash.descendants | |
# ActiveRecord::Base.descendants | |
# | |
module Descendants | |
def descendants | |
ary = [] |
This file contains 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
/* | |
Jquery and Rails powered default application.js | |
Easy Ajax replacement for remote_functions and ajax_form based on class name | |
All actions will reply to the .js format | |
Unostrusive, will only works if Javascript enabled, if not, respond to an HTML as a normal link | |
respond_to do |format| | |
format.html | |
format.js {render :layout => false} | |
end | |
*/ |
This file contains 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
# config/initializers/template_handlers.rb | |
require 'action_view/template/handlers/textile' | |
ActionView::Template.register_template_handler :textile, ActionView::Template::Handlers::Textile.new |
This file contains 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
# coding: utf-8 | |
require 'rest-client' | |
require 'json' | |
require 'date' | |
require 'gmail' | |
require 'yaml' | |
#google-api-clientはv0.6.4が必要です | |
require "google/api_client" |
This file contains 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
## | |
## with raw object | |
## | |
# create a new object | |
o = Object.new | |
# define methods on the object (precisely, the object's singleton) | |
class << o | |
def hello(thing) |