git flow init -d
(Omit -d
if you want to select values other than the defaults.)
# 仅去掉了烦人的提示,足够了。 | |
# 使用说明 | |
# ruby crack.rb "/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2" | |
# only for build 2210 | |
# coded by hhuai. | |
#特征码取值 | |
magic_code="\x55\x48\x89\xE5\x53\x48\x83\xEC\x08\x80\x3D\x10\x56\x51\x00\x00\x75\x70\xE8\x09\x7B\xF1\xFF\x48\x89\xC3\x48\x89\xD8\x48\x2B\x05\xC4\x17\x51\x00\x48\x3D\x80\xCB\xA4\x00\x7C\x56\xFF\x05\xBE\x17\x51\x00\xE8\xB7\xE7\x2C\x00\x8B\x0D\xB3\x17\x51\x00\x83\xF9\x02\x0F\x9F\xC2\xA8\x0F\x0F\x94\xC0\x84\xC2\x75\x05\x83\xF9\x08\x7E\x31\xC7\x05\x95\x17\x51\x00\x00\x00\x00\x00\x48\x89\x1D\x86\x17\x51\x00\x31\xFF\x48\x8D\x35\x9D\xC8\x3B\x00\x48\x8D\x15\x6B\xC9" | |
crack_code="\x55\x48\x89\xE5\x53\x48\x83\xEC\x08\x80\x3D\x10\x56\x51\x00\x00\x74\x70\xE8\x09\x7B\xF1\xFF\x48\x89\xC3\x48\x89\xD8\x48\x2B\x05\xC4\x17\x51\x00\x48\x3D\x80\xCB\xA4\x00\x7C\x56\xFF\x05\xBE\x17\x51\x00\xE8\xB7\xE7\x2C\x00\x8B\x0D\xB3\x17\x51\x00\x83\xF9\x02\x0F\x9F\xC2\xA8\x0F\x0F\x94\xC0\x84\xC2\x75\x05\x83\xF9\x08\x7E\x31\xC7\x05\x95\x17\x51\x00\x00\x00\x00\x00\x48\x89\x1D\x86\x17\x51\x00\x31\ |
# space150 vine-to-GIF | |
# given a vine.co uri, downloads the MP4 and creates an image sequence / GIF from it | |
# requires ruby, ffmpeg, and imagemagick | |
require 'open-uri' | |
require 'nokogiri' | |
id = ARGV[0] | |
# try to convert from URL to id. |
import Foundation | |
class APIService : NSObject { | |
private let sourcesURL = URL(string: "http://dummy.restapiexample.com/api/v1/employees")! | |
func apiToGetEmployeeData(completion : @escaping (Employees) -> ()){ | |
URLSession.shared.dataTask(with: sourcesURL) { (data, urlResponse, error) in | |
if let data = data { | |
let jsonDecoder = JSONDecoder() | |
let empData = try! jsonDecoder.decode(Employees.self, from: data) |
func JSONParseDict(jsonString:String) -> Dictionary<String, AnyObject> { | |
var e: NSError? | |
var data: NSData = jsonString.dataUsingEncoding( | |
NSUTF8StringEncoding) | |
var jsonObj = NSJSONSerialization.JSONObjectWithData( | |
data, | |
options: NSJSONReadingOptions(0), | |
error: &e) as Dictionary<String, AnyObject> | |
if e { | |
return Dictionary<String, AnyObject>() |
1. | |
LOGIN_PAGE=http://localhost/users/sign_in | |
curl --cookie-jar cookie_file $LOGIN_PAGE | grep csrf-token | |
2. | |
<meta content="csrf-token" name="csrf-token" /> | |
unless Rails.env.production? | |
connection = ActiveRecord::Base.connection | |
connection.tables.each do |table| | |
connection.execute("TRUNCATE #{table}") unless table == "schema_migrations" | |
end | |
sql = File.read('db/import.sql') | |
statements = sql.split(/;$/) | |
statements.pop |
# /app/helpers/devise_helper.rb | |
module DeviseHelper | |
def devise_error_messages! | |
return '' if resource.errors.empty? | |
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join | |
sentence = I18n.t('errors.messages.not_saved', | |
count: resource.errors.count, | |
resource: resource.class.model_name.human.downcase) |
require 'rubygems' | |
require 'mini_magick' | |
img = MiniMagick::Image.from_file("jpeg.jpg") | |
img.combine_options do |c| | |
c.gravity 'Southwest' | |
c.draw 'text 10,10 "whatever"' | |
c.font '-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-2' | |
c.fill("#FFFFFF") | |
end |
# Coffeescript | |
$.rails.allowAction = (link) -> | |
return true unless link.attr('data-confirm') | |
$.rails.showConfirmDialog(link) # look bellow for implementations | |
false # always stops the action since code runs asynchronously | |
$.rails.confirmed = (link) -> | |
link.removeAttr('data-confirm') | |
link.trigger('click.rails') |