gem 'jquery-rails'
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
/** | |
* This code uses Apache Chemistry (http://chemistry.apache.org/). | |
* License accords to Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | |
*/ | |
import java.io.ByteArrayInputStream; | |
import java.io.UnsupportedEncodingException; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.Map; |
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
def generate_tgz(filepath, contents) | |
tar = StringIO.new | |
Gem::Package::TarWriter.new(tar) do |writer| | |
writer.add_file(filepath, 0600) do |f| | |
f.write(contents) | |
end | |
end | |
tar.seek(0) | |
gz = Zlib::GzipWriter.open("#{filepath}.tar.gz") do |gz| | |
gz.write(tar.read) |
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
# sample task model | |
# | |
# > rails c | |
# irb(main):004:0> t.finish | |
# "-------> notify_done with 0" | |
# "-------> notify_done with 1" | |
# "-------> notify_done with 2" | |
# "-------> notify_done end" | |
# => true | |
class Task < ActiveRecord::Base |
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
require 'csv' | |
require 'octokit' | |
require 'pry' | |
BEGIN_OF_2019 = Time.new('2019-01-01 00:00:00 UTC') | |
def client | |
@client ||= Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN'], per_page: 100) | |
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
""" | |
ref. https://gist.github.com/mike-ward/23dab967feaf71bde2c1 | |
Exports Issues from a specified repository to a CSV file | |
- Github API v3: https://developer.github.com/v3/gists/ | |
- ZenHub API: https://github.com/ZenHubIO/API | |
""" | |
import csv | |
import requests |
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
require 'base64' | |
require 'openssl' | |
def enc(der, msg) | |
rsa = OpenSSL::PKey::RSA.new(der) | |
rsa.private_encrypt(msg) | |
end | |
def dec(der, msg) | |
rsa = OpenSSL::PKey::RSA.new(der) |
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
require 'aws' | |
require 'aws-sdk' | |
ACCESS_KEY_ID='access key' | |
SECRET_ACCESS_KEY='secret access key' | |
TABLE='table name' | |
MAX_ITEMS=100 | |
AWS.config({ | |
access_key_id: ACCESS_KEY_ID, |
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
# | |
# aws | |
# | |
# declare variables | |
variable "aws_access_key" {} | |
variable "aws_secret_access_key" {} | |
# connection |
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 namespace std; | |
enum Color { | |
red, green, blue, | |
white = 10, black = white, | |
silver, gold = 99 | |
}; | |
int main() | |
{ |
NewerOlder