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
package example | |
import java.sql.DriverManager | |
import java.util | |
import com.microsoft.sqlserver.jdbc.{ISQLServerBulkData, SQLServerBulkCopy} | |
import scala.jdk.CollectionConverters._ | |
class ReproData extends ISQLServerBulkData { | |
override def getColumnOrdinals: util.Set[Integer] = (1 to 10).map(_.asInstanceOf[Integer]).toSet.asJava |
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
from string import Template | |
from datetime import datetime, timedelta | |
template = """ | |
from airflow import DAG | |
from datetime import datetime, timedelta | |
from airflow.operators.python_operator import PythonVirtualenvOperator | |
DEFAULT_ARGS = { |
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
[ | |
{ | |
"name": "mydb", | |
"value": "jdbc:sqlserver://localhost:1433/mydb" | |
}, | |
{ | |
"name": "another_db", | |
"value": "jdbc:postgresql://localhost:5432/db" | |
} | |
] |
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
irb(main):001:0> s = StringIO.new | |
=> #<StringIO:0x00005558cba587e0> | |
irb(main):002:0> s.write('message') | |
=> 7 | |
irb(main):003:0> s.rewind | |
=> 0 | |
irb(main):004:0> s.read | |
=> "message" |
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
class Workflow | |
attr_accessor :name, :inputs | |
def to_s | |
"workflow #{name} {\n".tap do |result| | |
inputs.each do |input| | |
result << "#{input.to_s}\n" | |
end | |
result << "}" | |
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
module Settings | |
DISCRIMINATOR = :type | |
TYPE_TO_CLASS = Hash[Setting.subclasses.map { |klass| [klass.name.underscore, klass] }].freeze | |
class SettingRepresenter < Representable::Decorator | |
include ::Representable::JSON | |
property :name | |
property DISCRIMINATOR, skip_parse: true, getter: lambda {|options| options[:represented].class.name.underscore } |
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
User = Struct.new(:email) | |
Post = Struct.new(:user, :text) | |
class PostRepresenter < Representable::Decorator | |
include Representable::JSON | |
property :text | |
property :user, populator: lambda { |input, options| options[:represented].user = User.new } | |
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
@filenames, @urls = *product.images.map { |i| [i.original_filename, i.image_original_url] }.transpose.map(&:to_set) |
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
using System; | |
public interface FSM<S,E,T> { | |
public void defineTransition(S oldState, E event, S newState, Action<T> action); | |
public void consumeEvent(E event); | |
public S getState(); | |
public void setState(S newState); | |
} |
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
class None | |
def map(&block) | |
self | |
end | |
def flat_map(&block) | |
self | |
end | |
def value |
NewerOlder