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
var getConstructor = function (classPath) { | |
var classPaths = classPath.split('.'); | |
var obj = window; | |
for (index in classPaths) { | |
obj = obj[classPaths[index]]; | |
} | |
return obj; | |
}; | |
namespace1 = {}; |
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
$(function(){ | |
var randomNum = Math.floor(Math.random() * 10000); | |
$.post("/profile",{'_method':'put','user[nick_name]':'I Love Feng Zhichao ' + randomNum}); | |
}); |
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
.calendar | |
%h1.month December 2013 | |
%ol.day-names | |
%li Sunday | |
%li Monday | |
%li Tuesday | |
%li Wednesday | |
%li Thursday | |
%li Friday | |
%li Saturday |
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 A | |
def pub_method | |
puts 'pub_method' | |
end | |
private | |
def pri_method | |
puts 'pri_method' | |
end | |
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> |
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
# 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
# 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
# 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
module Sayable | |
def self.included(host_class) | |
host_class.extend ClassMethods | |
end | |
module ClassMethods | |
def sound sound | |
@the_sound = sound | |
end |
OlderNewer