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
array = ["one","two","three","four","five"] | |
join = array[0..-2].join(', ') + " and " + array[-1].to_s + " are numbers that belongs to the array of integers." | |
puts join | |
# "one, two, three, four and five are numbers that belongs to the array of integers." |
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
cd <project> | |
find . -name ".svn" -exec rm -rf {} 2> /dev/null \; | |
cd .. | |
cp -ru <project>/* <svn-project> | |
cd <svn-project> | |
svn status |
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
require 'rubygems' | |
require 'sinatra' | |
require 'sinatra/mapping' | |
require 'blogware' | |
run Sinatra::Application |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra' | |
require 'sinatra/mapping' # only this line for use mapping! | |
map :root, "blog" # /blog/ | |
map :entries, "posts" # /blog/posts | |
map :tags, "labels" # /blog/labels | |
mapping :entry => "posts/:entry_id", # /blog/posts/id-for-post |
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 learn; | |
import static spark.Spark.*; | |
import spark.*; | |
import java.io.*; | |
import java.util.Map; | |
import java.util.HashMap; | |
import java.util.regex.Pattern; |
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
# Configuration | |
PLUGIN_NAME = markdown | |
PLUGIN_VERSION = 2.0.0 | |
MAKEDIR = build | |
HOMEDIR = tmp | |
SRCDIR = src | |
PKGDIR = pkg | |
SYNTAX = $(MAKEDIR)/syntax/$(PLUGIN_NAME).vim |
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
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
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
#!/usr/bin/env ruby | |
#/ Usage: <progname> [options]... | |
#/ How does this script make my life easier? | |
# ** Tip: use #/ lines to define the --help usage message. | |
$stderr.sync = true | |
require 'optparse' | |
# default options | |
flag = false | |
option = "default value" |
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
Array.prototype.orderItems = function(newer, older) { | |
var list = new Array(...this) | |
return list.splice(newer - 1, 0, ...list.splice(older, 1)) | |
} |
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
function jwtDecode(token) { | |
var base64Url = token.split('.')[1]; | |
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); | |
var payload = decodeURIComponent(atob(base64).split('').map(function(c) { | |
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); | |
}).join('')); | |
return JSON.parse(payload); | |
}; |
OlderNewer