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
Run in command line: | |
RAILS_ENV=production rake db:create db:schema:load |
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
## Download | |
scp user@remote_host:remote_file local_file | |
## Upload | |
scp local_file user@remote_host:remote_file |
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
# With these tasks you can: | |
# - dump your production database and save it in shared_path/db_backups | |
# - download most recent backup | |
namespace :db do | |
task :backup_name, :roles => :db, :only => { :primary => true } do | |
now = Time.now | |
run "mkdir -p #{shared_path}/db_backups" | |
backup_time = [now.year,now.month,now.day,now.hour,now.min,now.sec].join('-') | |
set :backup_file, "#{shared_path}/db_backups/#{application}-snapshot-#{backup_time}.sql" | |
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
$('#export').on('click', e => { | |
e.preventDefault(); | |
tableToExcel('table', 'Servers'); | |
}) | |
var tableToExcel = (function () { | |
var uri = 'data:application/vnd.ms-excel;base64,' | |
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>' | |
, base64 = function (s) { return window.btoa(window['unescape'](encodeURIComponent(s))) } | |
, format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) } |
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
# Public: Execute a git command. | |
# | |
# options - An {Object} with the following keys: | |
# :args - The {Array} containing the arguments to pass. | |
# :cwd - Current working directory as {String}. | |
# :options - The {Object} with options to pass. | |
# :stdout - The {Function} to pass the stdout to. | |
# :exit - The {Function} to pass the exit code to. | |
# | |
# Returns nothing. |
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
gitStagedFiles = (repo, stdout) -> | |
files = [] | |
gitCmd | |
args: ['diff-index', '--cached', 'HEAD', '--name-status', '-z'] | |
cwd: repo.getWorkingDirectory() | |
stdout: (data) -> | |
files = _prettify(data) | |
stderr: (data) -> | |
# edge case of no HEAD at initial commit | |
if data.toString().includes "ambiguous argument 'HEAD'" |
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
git.cmd = (args, options={}) -> | |
new Promise (resolve, reject) -> | |
output = '' | |
try | |
new BufferedProcess | |
command: atom.config.get('git-plus.gitPath') ? 'git' | |
args: args | |
options: options | |
stdout: (data) -> output += data.toString() | |
stderr: (data) -> reject data.toString() |
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
gitAddAllCommitAndPush = (repo) -> | |
git.add repo, | |
exit: -> | |
new GitCommit(repo, andPush: 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
git.add(repo).then -> GitCommit(repo, andPush: 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
module.exports = (func) -> | |
xs = [] | |
curry = (x) -> | |
if x | |
xs.push x | |
curry | |
else | |
xs = [0] if xs.length is 0 | |
func.apply null, xs |
OlderNewer