Skip to content

Instantly share code, notes, and snippets.

View hachi8833's full-sized avatar
😀

Shozo Hatta hachi8833

😀
View GitHub Profile
@rummelonp
rummelonp / faraday.md
Last active May 20, 2022 12:23
Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた

[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた

@lunark
lunark / GenderEstimate.bas
Last active October 14, 2023 04:04
VBAマクロ向け関数。GenderEstimate。漢字の名前とふりがなから、性別を推定する関数
Public Function GenderEstimate(ByVal strMK As String, Optional strMF As String = "") As String
GenderEstimate = ""
strMK = Replace(Replace(Replace(strMK, " ", ""), " ", ""), "「", "")
strMF = Replace(Replace(StrConv(strMF, vbHiragana), " ", ""), " ", "")
'デバッグ用。こいつをブレークポイントに持ってきて挙動を確認する
'If strMK Like "理世" Then
' Debug.Print strMK
'End If
{
"directory": "components"
}
@voising
voising / gists_to_dash_db.rb
Last active October 21, 2021 21:32
Connect Gists with Dash (Code Snippet Manager)
#!/usr/bin/env ruby
if ARGV[0].nil? || ARGV[0].match(/-h/)
puts "Usage : #{$0} github_username dash_sqlite_db char_appended_to_keyword [no_comments]"
exit
end
require 'net/http'
require 'open-uri'
#require 'awesome_print'
@tokenvolt
tokenvolt / simple_form_bootstrap3.rb
Last active November 2, 2023 11:55
Bootstrap 3 simple form initializer
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
@meddulla
meddulla / gosimplejson_iteratemap.go
Created November 10, 2013 17:08
iterate over a go-simplejson map
import (
simplejson "github.com/bitly/go-simplejson"
"log"
)
func testMapIter () {
js, _ := simplejson.NewJson([]byte(`{
"test": {
"string_array": ["asdf", "ghjk", "zxcv"],
@sgr
sgr / workaround_the_iconservices_bug_mavericks.sh
Last active July 25, 2020 11:01
When "com.apple.IconServicesAgent" exhausts CPU resources on Mac OSX mavericks (10.9), you can try following workaround.
#!/bin/sh
mkdir ${TMPDIR}/com.apple.IconServices
@alexpchin
alexpchin / Ruby_Rails_Naming_Conventions.md
Created May 8, 2014 10:56
Ruby & Rails Naming Conventions

Alex's Rails Cheat Sheet

I think the most confusing thing that I have found about Ruby on Rails so far has been the transition from (trying to) write code myself to the use of the fabled "Rails Magic". So, to help my own understanding of a few core Ruby on Rails concepts, I have decided to write something on what I think is a CRITICAL topic... the idea of Convention over Configuration and why (in my mind) it is the most important thing that helps Rails become magic!

(This may be a topic that we cover in more detail in class but as I said, I'm writing this for my own understanding... I hope it helps someone else understand things too... Perhaps you can give me a hand when I'm crying next week!)

##Convention over configuration ###What does this "actually" mean...

@JunichiIto
JunichiIto / alias_matchers.md
Last active April 16, 2024 16:18
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
package main
import (
"fmt"
"math/rand"
"os"
"strconv"
"runtime"
)