-
Open the Terminal
-
Use
mysqldump
to backup your databases -
Check for MySQL processes with:
ps -ax | grep mysql
-
Stop and kill any MySQL processes
-
Analyze MySQL on HomeBrew:
brew remove mysql
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
1) In your terminal, open the file using vim: | |
vim file_name | |
2) Remove all BOM characters: | |
:set nobomb | |
3) Save the file: | |
:wq |
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
require "benchmark" | |
n = 10000 | |
arr = (1..1000).to_a | |
zip = arr.zip arr | |
hash = Hash[zip] | |
Benchmark.bm do |x| | |
x.report("%-30s" %["sampling array"]) { n.times do | |
arr.sample |
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
require 'rubygems' | |
require 'zip' | |
archive_directory_path = '' | |
archive_zip_path = '' | |
Zip::File.open( archive_zip_path, Zip::File::CREATE ) do |zip_file| | |
Dir[ File.join( archive_directory_path, "**", "**" ) ].each do |file| | |
zip_file.add( file.sub( "#{ archive_directory_path }/", "" ), file ) | |
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
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |
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
// Available in jCanvas v20.1.0 | |
// The pixel multiple to snap to | |
var snapToAmount = 40; | |
// Round the given value to the nearest multiple of n | |
function nearest(value, n) { | |
return Math.round(value / n) * n; | |
} | |
$('canvas').drawArc({ | |
layer: true, |
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
h = { | |
'a' => :a_value, | |
'b' => nil, | |
'c' => false | |
} | |
h.fetch('a', :default_value) #=> :a_value | |
h.fetch('b', :default_value) #=> nil | |
h.fetch('c', :default_value) #=> false | |
h.fetch('d', :default_value) #=> :default_value |
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
/** | |
* Change file modification time to the date from EXIF | |
* | |
* System Requirements: | |
* | |
* > npm install -g includejs | |
* > npm install -g exif | |
* | |
* Usage: | |
* |
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
# Ensures the model has an attr_accessor, attr_reader or attr_writer | |
# Examples: | |
# it { should have_attr_accessor(:value) } | |
# it { should have_attr_accessor(:value).read_only } | |
# it { should have_attr_accessor(:value).write_only } | |
module Shoulda | |
module Matchers | |
module ActiveModel # :nodoc | |
def have_attr_accessor(attribute) |