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
Are you using Capistrano and Git and want to easily deploy from Git tags? It couldn't be simpler | |
Using Git, tag a new release: | |
git tag -a 09.10.02.01 -m "Tagging a release" | |
You can use git tag to list your tags: | |
git tag | |
09.10.01.01 | |
09.10.01.02 |
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
[url, height, width, output_dir] = phantom.args | |
console.log("url #{url}, height #{height}, width #{width}, output_dir #{output_dir}") | |
page = require('webpage').create() | |
page.viewportSize = | |
width: width | |
height: height | |
page.onConsoleMessage = (msg) -> |
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
namespace :coffee do | |
task :compile, :filename do |t, args| | |
filename = args.filename | |
puts CoffeeScript.compile(File.open(filename)) | |
end | |
end | |
Then, you can compile a single file from like this: | |
$ rake coffee:compile[app/assets/javascripts/mystuff.js.coffee] |
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
Use "pk: null" instead of "pk: 1" (or whatever), which will result in the PK being set to None, and when the object is saved a primary key will be assigned. | |
This works for YAML at least, I'm guessing you're using that if you are creating by hand. |
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 'zip' | |
# Usage: | |
# directoryToZip = "/tmp/input" | |
# outputFile = "/tmp/out.zip" | |
# zf = ZipFileGenerator.new(directoryToZip, outputFile) | |
# zf.write() | |
class ZipFileGenerator | |
def initialize(inputDir, outputFile) | |
@inputDir = inputDir |
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
Zip::ZipFile.open(file_path) do |zip_file| | |
zip_file.each do |f| | |
f_path=File.join("destination_path", f.name) | |
FileUtils.mkdir_p(File.dirname(f_path)) | |
zip_file.extract(f, f_path) unless File.exist?(f_path) | |
end | |
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
var fn = function(arg1, arg2) { | |
var str = '<p>aap ' + this.noot + ' ' + arg1 + ' ' + arg2 + '</p>'; | |
document.body.innerHTML += str; | |
}; | |
var context = { | |
'noot': 'noot' | |
}; | |
var args = ['mies', 'wim']; | |
// Calls a function with a given 'this' value and arguments provided individually. |
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
RSpec::Core::RakeTask.module_eval do | |
def pattern | |
dir = EngineName.root # replace with you the name of your engine | |
extras = [] | |
if File.directory?( dir ) | |
extras << File.join( dir, 'spec', '**', '*_spec.rb' ).to_s | |
end | |
[@pattern] | extras | |
end | |
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
$ ./executable-with-subcommands-using-thor.rb | |
Tasks: | |
executable-with-subcommands-using-thor.rb help [TASK] # Describe available tasks or one specific task | |
executable-with-subcommands-using-thor.rb subA [TASK] # Execute a task in namespace subA | |
executable-with-subcommands-using-thor.rb subB [TASK] # Execute a task in namespace subB | |
executable-with-subcommands-using-thor.rb test # test in CLI | |
$ ./executable-with-subcommands-using-thor.rb help | |
Tasks: | |
executable-with-subcommands-using-thor.rb help [TASK] # Describe available tasks or one specific task |
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
{ | |
"auto_indent": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/User/SublimeLinter/Sunburst (SL).tmTheme", | |
"draw_indent_guides": true, | |
"ensure_newline_at_eof_on_save": true, | |
"folder_exclude_patterns": | |
[ | |
"log", | |
".git", |