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
| // Copy this file to the root directory of local directory from ttps://github.com/seatonjiang/gitmoji-vscode/ | |
| const fs = require('fs'); | |
| const jaDict = require('./languages/bundle.l10n.ja.json'); | |
| const indexOfLineIncludes = (lines, s) => { | |
| let idx = -1 | |
| lines.forEach((line,i) => { if (line.includes(s)) idx = i }) | |
| return idx | |
| } |
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
| lines = \ | |
| STDIN.readlines.reject{|x| x =~ /\A--/}. | |
| reject{|x| x =~ %r{\A\s*/\*.+\*/;\s\z}}. | |
| reject{|x| x =~ /\A\s*DROP TABLE.+;\s*\z/}. | |
| reject{|x| x =~ /\A\s*UNIQUE KEY .+,\s*\z/}. | |
| reject{|x| x =~ /\A\s*KEY .+,\s*\z/}. | |
| reject{|x| x =~ /\A\s*CONSTRAINT .+,?\s*\z/} | |
| lines = lines.map{|x| x.sub(/\A([^\`]*)\`([^\`]+)\`(.+)/, '\1\2\3') } | |
| text = lines.join | |
| text.gsub!(/\) ENGINE=InnoDB .+\;/, ")") |
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
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "os" | |
| "os/signal" | |
| "strconv" | |
| "syscall" | |
| "time" |
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
| package main | |
| import ( | |
| "fmt" | |
| "github.com/friendsofgo/errors" | |
| ) | |
| func main() { | |
| err := foo1() |
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 go playground or https://github.com/traefik/yaegi to try | |
| func foo(v int) (rerr error) { | |
| if v%3 == 1 { | |
| defer func() { | |
| rerr = fmt.Errorf("error %d mod 3 => 1: overwrite", v) | |
| }() | |
| } else if v%3 == 2 { | |
| defer func() { | |
| err := fmt.Errorf("error %d mod 3 => 2: set error if nil", v) |
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
| # https://golangci-lint.run/usage/configuration/ | |
| run: | |
| timeout: 5m | |
| linters-settings: | |
| govet: | |
| settings: | |
| unusedresult: | |
| funcs: | |
| - github.com/akm/repo1/path/to/package1.Function1 |
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
| package main | |
| // This is my first go program written in Dec 22nd, 2016 | |
| import ( | |
| "fmt" | |
| "sync" | |
| ) | |
| type Fetcher interface { |
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
| ARGV.each do |keyword| | |
| image_family_names = `docker search #{keyword} --format '{{.Name}}'`.split("\n") | |
| puts( (["image family names:"] + image_family_names).join("\n") ) | |
| image_family_names.each do |image_family_name| | |
| tags = `curl -s https://registry.hub.docker.com/v1/repositories/#{image_family_name}/tags | jq -r '.[].name'`.split("\n") | |
| puts("#{image_family_name} tags: #{tags.join(',')}") | |
| tags.each do |tag| | |
| image_name = image_family_name + ':' + tag | |
| file_name = image_family_name.gsub('/', '-') + '-' + tag + '.tar.gz' | |
| if File.exist?(file_name) |
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
| module Bar | |
| def bar | |
| "bar" | |
| end | |
| end | |
| class Foo | |
| include Bar | |
| 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 Prcss | |
| attr_accessor :pid, :ppid, :command | |
| attr_reader :done | |
| def initialize(pid, ppid, command) | |
| @pid = pid.to_i | |
| @ppid = ppid.to_i | |
| @command = command | |
| end |
NewerOlder