Skip to content

Instantly share code, notes, and snippets.

View colorbox's full-sized avatar
๐Ÿ’ญ
๐Ÿ˜‡

colorbox colorbox

๐Ÿ’ญ
๐Ÿ˜‡
View GitHub Profile
@sonnguyen0310
sonnguyen0310 / gist:6720cbf39ce877c20fea1a987543fb99
Created July 2, 2018 08:31
iOS 11: Change size of UIBarButtonItem (image) in Swift 3
func setUpMenuButton(){
let menuBtn = UIButton(type: .custom)
menuBtn.frame = CGRect(x: 0.0, y: 0.0, width: 20, height: 20)
menuBtn.setImage(UIImage(named:"menuIcon"), for: .normal)
menuBtn.addTarget(self, action: #selector(vc.onMenuButtonPressed(_:)), for: UIControlEvents.touchUpInside)
let menuBarItem = UIBarButtonItem(customView: menuBtn)
let currWidth = menuBarItem.customView?.widthAnchor.constraint(equalToConstant: 24)
currWidth?.isActive = true
let currHeight = menuBarItem.customView?.heightAnchor.constraint(equalToConstant: 24)
<div id=root />
<script type=module>
import React from 'https://dev.jspm.io/react@16'
import ReactDOM from 'https://dev.jspm.io/react-dom@16'
ReactDOM.render(
React.createElement('h1', null, 'hello'),
document.querySelector('#root')
)
</script>
class Object
def defer(method, *args)
@current_fibers ||= []
@tracepoint ||= TracePoint.trace(:return) do |tp|
@current_fibers.reverse_each do |fib|
fib.resume
end
end
@current_fibers << Fiber.new do
@voluntas
voluntas / working_time.rst
Last active October 21, 2024 15:20
ๆ™‚้›จๅ ‚ใ‚’ๆ”ฏใˆใ‚‹ๅ›บๅฎšๆ™‚้–“ๅŠดๅƒ 1 ๆ—ฅ 6ย ๆ™‚้–“

ๆ™‚้›จๅ ‚ใ‚’ๆ”ฏใˆใ‚‹ๅ›บๅฎšๆ™‚้–“ๅŠดๅƒ 1 ๆ—ฅ 6 ๆ™‚้–“

ๆ›ดๆ–ฐ:2024-01-20
ไฝœ่€…:@voluntas
ใƒใƒผใ‚ธใƒงใƒณ:2024.1
URL:https://voluntas.github.io/

ๆฆ‚่ฆ

# solver.rb ใฎ Range ใ‚’ Array ใซ็ฝฎใๆ›ใˆใฆๆ—ฉใใ—ใŸ็‰ˆ
# ๅฎŸ่กŒใ™ใ‚‹ๆ™‚ใฏใƒ•ใ‚กใ‚คใƒซๅใ‚’ solver.rb ใซใ—ใฆใใ ใ•ใ„
module Solver
def parse_triangle(src)
/(\d+),(\d+)(\w)(\d+)/.match(src) {|m|
x = m[1].to_i
y = m[2].to_i
direction = m[3]
height = m[4].to_i
@cheeaun
cheeaun / rdrc2017.md
Last active October 11, 2017 06:56
RedDotRubyConf 2017 links & resources ๐Ÿ˜˜
@ralbt
ralbt / inorder_tree_traversal.rb
Last active June 24, 2019 09:27
Ruby: Inorder tree traversal with and without recursion
class BinaryTree
attr_reader :root
def initialize(root)
@root = root
end
def print_inorder_with_recursion(current)
return if current.nil?
@voluntas
voluntas / naze_erlang.rst
Last active October 31, 2023 03:33
ใชใœ Erlang/OTP ใ‚’ไฝฟใ„็ถšใ‘ใ‚‹ใฎใ‹

ใชใœ Erlang/OTP ใ‚’ไฝฟใ„็ถšใ‘ใ‚‹ใฎใ‹

ๆ›ดๆ–ฐ:2017-04-03
ไฝœ่€…:@voluntas
ใƒใƒผใ‚ธใƒงใƒณ:1.0.6
URL:https://voluntas.github.io/

2017 ๅนด 4 ๆœˆ 1 ๆ—ฅใซ่กŒใ‚ใ‚ŒใŸ Elixir Conf Japan 2017 ใฎ็™บ่กจ่€…็”จใฎใƒกใƒขใงใ™ใ€‚

@trilliwon
trilliwon / uiimage-data.swift
Last active January 12, 2024 14:45
Swift UIImage to Data, Data to UIImage
// Swift4
let image = UIImage(named: "sample")
let data = image?.pngData()
let data = image?.jpegData(compressionQuality: 0.9)
let uiImage: UIImage = UIImage(data: imageData)
// deprecated
// var imageData: Data = UIImagePNGRepresentation(image)