This file contains hidden or 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
# frozen_string_literal: true | |
source 'https://rubygems.org' | |
ruby '>= 2.7' | |
gem 'stringio', '3.0.2' |
This file contains hidden or 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
# Put this in app/types/types/address.rb then | |
# rails c | |
# Types::Address.new | |
# (change zip to Types::String) | |
# reload! | |
# Types::Address.new | |
module Types | |
class Address < Dry::Types::Struct | |
constructor_type(:schema) |
This file contains hidden or 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
class User < Dry::Types::Struct | |
attribute :name, Types::String | |
attribute :birth_day, Types::Date | |
end | |
UserSchema = Dry::Validation.Schema do | |
key(:name).required | |
key(:birth_date).required(:date?) | |
end |
This file contains hidden or 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
class User < Dry::Types::Struct | |
attribute :name, Types::String | |
attribute :birth_day, Types::Date | |
end | |
class User < Dry::Types::Struct | |
attribute :name, Types::String | |
attribute :birth_date, Types::Coercible::Date | |
end |
This file contains hidden or 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
Refile::MiniMagick.prepend Module.new { | |
define_method('rotate') do |img, angle=0| | |
img.combine_options do |cmd| | |
yield cmd if block_given? | |
cmd.rotate angle | |
end | |
end | |
define_method('fill_rotate') do |img, width, height, angle=0, gravity="Center"| | |
# We use `convert` to work around GraphicsMagick's absence of "gravity" |
This file contains hidden or 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
# constant-time comparison algorithm to prevent timing attacks | |
def self.secure_compare(a, b) | |
return false if a.blank? || b.blank? || a.bytesize != b.bytesize | |
l = a.unpack "C#{a.bytesize}" | |
res = 0 | |
b.each_byte { |byte| res |= byte ^ l.shift } | |
res == 0 | |
end | |
end |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'resolv' | |
require 'public_suffix' | |
email = ARGV[0] | |
domain = email.split("@").last | |
servers = %w(googlemail.com, google.com) |
This file contains hidden or 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
apr: | |
osx: | |
homebrew: | |
packages: [] | |
assimp: | |
osx: | |
homebrew: | |
packages: [assimp] | |
assimp-dev: | |
osx: |
This file contains hidden or 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
diff -r edccf8cc52e3 CMake/Packages/FindFreetype.cmake | |
--- a/CMake/Packages/FindFreetype.cmake Fri Jun 20 00:53:20 2014 +0200 | |
+++ b/CMake/Packages/FindFreetype.cmake Fri Oct 03 01:19:56 2014 +0200 | |
@@ -43,7 +43,7 @@ | |
findpkg_framework(FREETYPE) | |
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") | |
-find_path(FREETYPE_INCLUDE_DIR NAMES freetype/freetype.h HINTS ${FREETYPE_INC_SEARCH_PATH} ${FREETYPE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES freetype2) | |
+find_path(FREETYPE_INCLUDE_DIR NAMES freetype.h HINTS ${FREETYPE_INC_SEARCH_PATH} ${FREETYPE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES freetype2) | |
find_path(FREETYPE_FT2BUILD_INCLUDE_DIR NAMES ft2build.h HINTS ${FREETYPE_INC_SEARCH_PATH} ${FREETYPE_PKGC_INCLUDE_DIRS}) |
NewerOlder