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
system "curl -I https://jinshuju.net/f/EphY22\x81" |
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 'net/http' | |
require 'openssl' | |
require 'base64' | |
require 'json' | |
appid = 'APP_ID' | |
secret_id = 'SECRET_ID' | |
secret_key = 'SECRET_KEY' | |
current_time = Time.now.to_i | |
expired_time = current_time + 24 * 60 * 60 |
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
Mongoid.logger.level = Logger::DEBUG | |
Mongo::Logger.logger.level = Logger::DEBUG | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
Mongoid.logger = Logger.new(STDOUT) | |
Mongo::Logger.logger = Logger.new(STDOUT) | |
# limit of mongoid log truncated | |
Mongo::Monitoring::CommandLogSubscriber::LOG_STRING_LIMIT = 3000 |
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
module Sayable | |
def self.included(host_class) | |
host_class.extend ClassMethods | |
end | |
module ClassMethods | |
def sound sound | |
@the_sound = sound | |
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
# example ruby code to create entry with table field using jinshuju.com v1 api | |
# help document for the api: https://help.jinshuju.net/articles/entry-api | |
require 'net/http' | |
require 'openssl' | |
subdomain = 'im' # your jinshuju.com subdomain | |
form_token = 'ZsKUgS' # fake token. put your form token here | |
key = 'A9f5kBbFRf71wpJvcaiwkC' # fake key. put your API Key here | |
secret = 'Ch6_XmbaaBr-ResDh0Ga9w' # fake secret. put your API Secret here |
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
# example ruby code to create entry using jinshuju.com v1 api | |
# help document for the api: https://help.jinshuju.net/articles/entry-api | |
require 'net/http' | |
require 'openssl' | |
subdomain = 'im' # your jinshuju.com subdomain | |
form_token = 'A1B2C3' # your form token | |
key = 'A9f5kBbFRf71wpJvcaiwkC' # your API Key | |
secret = 'Ch6_XmbaaBr-ResDh0Ga9w' # your API Secret |
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
# TEXT TO FIND: ^(\s+)(get|post|put|patch|destroy) :(index|show|edit|update|new|create|destroy), ([^params].+[^,])$ | |
# REPLACE WITH: $1$2 :$3, params: {$4} |
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
# Download Videos from Youtube in Ruby | |
# By: Sheharyar Naseer | |
require 'open-uri' | |
require 'cgi' | |
def tube(id) | |
'http://youtube.com/get_video_info?video_id=' + id | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>API Test</title> | |
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> | |
</head> | |
<body> | |
<script> |
NewerOlder