class User < ApplicationRecord
def self.current
Thread.current[:user]
end
def self.current=(user)
Thread.current[:user] = user
end
end
class ApplicationController < ActionController::Base
before_filter :set_current_user
def set_current_user
User.current = current_user
end
end
User.current// Add Atribute in some css class or div
jQuery(document).ready(function( $ ){
$('.menu-item').find('a').attr('data-toggle', 'dropdown');
});// Click on class or div, something and open link
$('.quform-button-submit-1_2').click(function(){
window.location.href='./thank-you';
}
// Remove some class and add different.
jQuery(document).ready(function( $ ){
var headr = $("#control-panel-header > img");
headr.remove();
var insertTitle = $("#control-panel-header");
insertTitle.append( '<p id="option-title">Share With Share</p>').css({ "color": "white", "font-size": "25px", "margin-bottom": "60px", "margin-top": "30px"});
});# Auto-Population
- Para auto popular um modelo, ele deve estender da classe **%Populate**
- Inicie um terminal e digite:
```bash
# para conectar no bash do container
docker exec -it database /bin/bash
# entrar na linha de comando do caché
csession SHIFTLIS
# alterar para namespace DEV
ZN "DEV"
```
- Popula a classe criando 10 registros Fake
```
Do ##class(ContactDB.Contact).Populate(10)
```
- Acessar terminal para executar SQL's
```
Do $SYSTEM.SQL.Shell()
```
- Executar uma query para listar os registros inseridos
```
SELECT * FROM ContactDB.Contact
```# Criando uma propriedade
## Wizard
Selecionar no menu:
Classe > Adicionar > Propriedade
## Definições
- Definir o nome da propriedade
- Definir o tipo da propriedade
- Definir características da propriedade
## Build
Após adicionar as opções clique no menu em:
Compilar > Compilar (Ctrl+F7)add_filter('upload_mimes', 'add_custom_upload_mimes');
function add_custom_upload_mimes($existing_mimes) {
$existing_mimes['otf'] = 'application/x-font-otf';
$existing_mimes['woff'] = 'application/x-font-woff';
$existing_mimes['ttf'] = 'application/x-font-ttf';
$existing_mimes['svg'] = 'image/svg+xml';
$existing_mimes['eot'] = 'application/vnd.ms-fontobject';
return $existing_mimes;
}yarn add --dev webpack-bundle-analyzer
bin/webpack --profile --json > tmp/webpack-stats.json
npx webpack-bundle-analyzer tmp/webpack-stats.json public/packs
// package.json
{
// ...
"scripts": {
"webpack:analyze": "yarn webpack:build_json && yarn webpack:analyze_json",
"webpack:build_json": "RAILS_ENV=${RAILS_ENV:-production} NODE_ENV=${NODE_ENV:-production} bin/webpack --profile --json > tmp/webpack-stats.json",
"webpack:analyze_json": "webpack-bundle-analyzer tmp/webpack-stats.json public/packs"
}
}
yarn webpack:analyze
namespace :webpack do
desc "Analyze the webpack build"
task :analyze => [:build_json, :analyze_json]
task :build_json do
system "RAILS_ENV=#{ENV.fetch('RAILS_ENV', 'production')} \
NODE_ENV=#{ENV.fetch('NODE_ENV', 'production')} \
bin/webpack --profile --json > tmp/webpack-stats.json"
end
task :analyze_json do
system "npx webpack-bundle-analyzer tmp/webpack-stats.json public/packs"
rescue Interrupt
end
end
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
<template>
<div class="sticky-tabs" v-bind="$attrs">
<el-tabs
v-model="activeTab"
@tab-click="tabClick"
lazy
>
<el-tab-pane
v-for="(tab, index) of tabs"
:key="tab + '-' + index"
:label="tab"
:name="tab"
></el-tab-pane>
<slot></slot>
</el-tabs>
</div>
</template>
<script>
import {
Tabs,
TabPane,
} from '@femessage/element-ui'
import _throttle from "lodash.throttle";
let scrollHandler = null;
export default {
name: 'sticky-tabs',
components: {
Tabs,
TabPane
},
props: {
tabs: {
type: Array,
default: () => [],
},
top: {
type: Number,
// TODO
default: 72 + 72 // nav + sticky-tabs
},
onClick: {
type: Function,
default: (tab, event) => {}
}
},
data() {
return {
activeTab: '',
}
},
mounted() {
scrollHandler = _throttle(this.onScroll, 300)
document.addEventListener("scroll", scrollHdotnet run --urls=http://localhost:5001/
git rm --cached file_namefunction addCSSRuleToDocument(rule) {
try {
let style = document.createElement("style");
let sheet = document.head.appendChild(style).sheet;
sheet.insertRule(rule, 0);
} catch (error) {
console.log("Failed to add rule; running on Chrome?");
console.error(error);
}
}# rootでログイン後実行
CREATE USER 'libro_new'@'localhost' IDENTIFIED BY 'R6WPAYd94XJZ';
# 権限確認
show grants for root@localhost;
# 権限付与
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
# rootでログイン
mysql -u root -pmypass
# Strips all ASCII characters from octal 000-011, and from 013-037
tr -d '\000-\011\013-\037' < file.txt > file.txt# 全体のディスク容量を確認
df -h
# ディレクトリ毎
# root直下
du -sh /*
# yumインストールデータのキャッシュ削除
# 容量確認
du -sh /var/cache/yum
# (すべてのキャッシュを削除)
yum clean all
# tmpデータの削除
/etc/cron.daily/tmpwatch