Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
Yeah!!

nownabe nownabe

💪
Yeah!!
View GitHub Profile
@nownabe
nownabe / block.rb
Last active Jul 8, 2019
Ruby block chain performance
View block.rb
require "benchmark/ips"
class A
def meth1(&block)
meth2(&block)
end
def meth2
yield
end
@nownabe
nownabe / deployment.yaml
Created Aug 22, 2018
Deserialize Kubernetes objects in Go
View deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: my-namespace
name: memcached
spec:
replicas: 1
selector:
matchLabels:
app: memcached
@nownabe
nownabe / instagram.rb
Created Apr 6, 2018
Instagram GraphQL API
View instagram.rb
# frozen_string_literal: true
require "faraday"
require "faraday_middleware"
endpoint = "https://www.instagram.com/graphql/query/"
# query_hash = "42323d64886122307be10013ad2dcc44"
# variables = '{"id":"3872941487","first":12,"after":"AQANkBj-f-ZzmLfmYiXU6qjC7nnHbpPttpppOPrL-i6mESM7hl04zzC50sCvA-RC3PFI98BtktoArwP9Ani1Z4dY067A1S6xvvhFqfgyJXJ5qw"}'
# csrf_token = "HIzZV98ydKLQmM6hGTtovnlqnrFwhsDf"
View rename.rb
# frozen_string_literal: true
require "color_echo"
patterns = {
/oldname/ => "newname",
}
skip_files = [
/^\.git\//,
@nownabe
nownabe / main.go
Created Mar 13, 2018
Go map memory
View main.go
package main
import (
"fmt"
"runtime"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
View pre-commit
#!/bin/bash
gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
[[ -z "${gofiles}" ]] && exit 0
make pre-commit
@nownabe
nownabe / .commit_template
Last active Jan 24, 2018
Emoji Commit Prefix
View .commit_template
# ==== Emojis ====
# 🌟 :sparkles: Adds a new feature or updates an existing feature
# 🐛 :bug: Fixes a bug
# ⚡ :zap: Improves performance of a feature
# 🔒 :lock: Fixes a security issue
# 🚿 :shower: Refactors an existing feature
# 👕 :tshirt: Fixes a code style violation
# 🔥 :fire: Deletes useless features, codes or files
# 📝 :pencil: Adds or updates a documentation
# 👮 :cop: Adds missing tests or correcs existing tests
@nownabe
nownabe / test_gems.sh
Last active Sep 24, 2017
GemTester Script
View test_gems.sh
#!/bin/bash
function install_build_dependencies_ubuntu() {
sudo apt-get install -y \
git ruby autoconf bison gcc make zlib1g-dev libffi-dev \
libreadline-dev libgdbm-dev libssl-dev
}
function install_test_dependencies_ubuntu() {
sudo apt-get install -y \
View mkmf.patch
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 7e40c2d..a6299a0 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -6,6 +6,61 @@
require 'rbconfig'
require 'fileutils'
require 'shellwords'
+require "pp"
+require "open3"
@nownabe
nownabe / test_gem.rb
Created Sep 1, 2017
Ruby Hack Challenge
View test_gem.rb
# Usage:
# $ make
# $ make install
# $ ./ruby test_gem.rb test GEM_NAME
require "rbconfig"
require "rubygems"
require "rubygems/gem_runner"
require "rubygems/exceptions"
require "yaml"
You can’t perform that action at this time.