Git-Flow
Initialize a Repository for git-flow
git flow init -d
(Omit -d
if you want to select values other than the defaults.)
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" /> | |
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) |
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 |
git flow init -d
(Omit -d
if you want to select values other than the defaults.)
# 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') |
// Place all the styles related to the welcome controller here. | |
// They will automatically be included in application.css. | |
// You can use Sass (SCSS) here: http://sass-lang.com/ | |
@import "bourbon"; | |
@import "neat"; | |
/* | |
* Variables | |
*/ |
select (case when tile = 50 then 'Median' when tile = 95 then '95%' else '5%' end) as tile | |
, app_display_version | |
, max(cast( ROUND(duration/1000)/1000 as numeric) ) max_duration_s | |
, min(cast( ROUND(duration/1000)/1000 as numeric) ) min_duration_s | |
from ( | |
select | |
trace_info.duration_us duration | |
, ntile(100) over (partition by (app_display_version) order by trace_info.duration_us) tile | |
, app_display_version |