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
SELECT (data_length+index_length)/power(1024,3) tablesize_mb | |
FROM information_schema.tables | |
WHERE table_schema='ProposalAgent' and table_name='proposals'; |
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
A Perfect Man | |
Best of Me - Good | |
Begin Again - Recommend | |
Celeste and Jesse Forever - Good | |
a case of you |
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
bundle exec mutant --include lib/ --require dynamics_crm --fail-fast --use rspec DynamicsCRM::Client |
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
# Turn off the automatic pager | |
Pry.config.pager = false | |
# Make the prompt silly. | |
Pry.config.prompt_name = 'oh no!' | |
# Hit Enter to repeat last command | |
#Pry::Commands.command(/^$/, 'repeat last command') do | |
# _pry_.run_command Pry.history.to_a.last | |
#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
redis-cli KEYS "Proposal*" | xargs redis-cli DEL |
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
# Default 1 MB | |
show variables like 'max_allowed_packet' | |
# 10 MB | |
set global max_allowed_packet=10485760 |
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
// Hacky way to strip unicode characters. | |
func CleanText(text string, maxLength int) string { | |
if len(text) < 5 { | |
return "" | |
} | |
if strings.Contains(text, "\n") { | |
sections := strings.Split(text, "\n") | |
newText := sections[0] | |
for idx, s := range sections { |
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
-- great way to batch update using a sub-query in the from clause | |
update category set catid=100 | |
from ( | |
select event.catid | |
from event | |
left join category cat on event.catid = cat.catid | |
where cat.catid is null | |
limit 1000 | |
) eventcat | |
where category.catid = eventcat.catid |
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
// NullInt64 is an alias for sql.NullInt64 data type | |
type NullInt64 sql.NullInt64 | |
// MarshalJSON for NullInt64 | |
func (ni *NullInt64) MarshalJSON() ([]byte, error) { | |
if !ni.Valid { | |
return []byte("null"), nil | |
} | |
return json.Marshal(ni.Int64) |
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
^[^iIoOqQ'-]{10,17}$ |