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
<div style="overflow-y: hidden; height: 440px; width: 1000px"> | |
<div class='tableauPlaceholder' id='viz1494212367852' style='position: relative; float: left'> | |
<noscript> | |
<a href='#'> | |
<img alt='Sheet 1 ' src='https://public.tableau.com/static/images/Fr/FreeDutyEngagement/Sheet1/1_rss.png' style='border: none' /> | |
</a> | |
</noscript> | |
<object class='tableauViz' style='display:none;'> | |
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> | |
<param name='site_root' 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
((total_scans*1.0)/total_campaign_members).round(1) | |
#=> | |
((total_scans * 1.0) / total_campaign_members).round(1) | |
validates_numericality_of :transaction_unit, 'greater_than' => 0, 'allow_nil' => true | |
#=> | |
validates_numericality_of :transaction_unit, greater_than: 0, allow_nil: true | |
WechatMessageJob.perform_later({openid: openid, article: wechat_article }) | |
#=> |
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
// CoffeeScript: | |
// @CampaignList = React.createClass | |
// | |
// render: -> | |
// div { className: 'content-wrapper' }, | |
// for campaign in @props.data | |
// React.createElement(CampaignCard, | |
// key: campaign.id | |
// campaign: campaign | |
// ) |
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
#1 QR Reader (https://itunes.apple.com/us/app/qr-reader-for-iphone/id368494609?mt=8) | |
-------- | |
Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Mobile/14A456 Safari | |
-------- | |
=> Double stack button | |
QR Scanner | |
-------- | |
Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Mobile/14A456 | |
-------- |
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 rake | |
require "bundler/gem_tasks" | |
require 'active_record' | |
require 'rspec/core/rake_task' | |
require 'appraisal' | |
require 'pg' | |
RSpec::Core::RakeTask.new :spec | |
Bundler::GemHelper.install_tasks |
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
def coin_change(coins, amount) | |
coins = coins.sort | |
coin = coins.first | |
multiples = (0..(amount / coin)).map{|division| division * coin} | |
solution = amount | |
if coins.count == 1 | |
if amount % coin != 0 | |
return -1 | |
else |
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
compressed_filestream = Zip::OutputStream.write_buffer(::StringIO.new(''), Zip::TraditionalEncrypter.new('password')) do |zos| | |
#First file | |
zos.put_next_entry "test1.csv" | |
csv = CSV.generate do |csv| | |
User.all.each do |user| | |
csv << [user.id, user.name] | |
end | |
csv << values | |
end | |
zos.print csv |
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 'benchmark' | |
person = Person.new(created_at: '2016-2-19') | |
time_1 = Benchmark.realtime do | |
100000.times do | |
person.read_attribute_before_type_cast(:created_at) | |
end | |
end | |
time_2 = Benchmark.realtime 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
import UIKit | |
extension NSMutableAttributedString { | |
func highlightTarget(target: String, color: UIColor) -> NSMutableAttributedString { | |
let targetValue = String(target.characters.dropFirst().dropLast()) | |
let regPattern = "\\[\(targetValue)\\]" | |
if let regex = try? NSRegularExpression(pattern: regPattern, options: []) { | |
let matchesArray = regex.matchesInString(self.string, options: [], range: NSRange(location: 0, length: self.length)) | |
for match in matchesArray { |
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 ~/.rbenv/plugins/ruby-build | |
$git pull |
NewerOlder