visit('/projects')
visit(post_comments_path(post))
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
$.rails.allowAction = (element) -> | |
message = element.data('confirm') | |
return true unless message | |
proceed = element.data('confirm-proceed') ? 'Proceed' | |
cancel = element.data('confirm-cancel') ? 'Cancel' | |
title = element.data('confirm-title') ? 'Confirm' | |
cancel_button_class = element.data('confirm-cancel-class') ? 'btn-default' | |
proceed_button_class = element.data('confirm-proceed-class') ? 'btn-danger' |
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 ruby | |
# Script to backup the Discourse postgres db and upload it to Amazon S3 | |
require 'rubygems' | |
require 'yaml' | |
require 'fog' | |
require 'time' | |
require 'date' | |
require 'fileutils' |
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
set --local bin_index (contains --index /usr/bin $PATH) | |
set --local local_bin_index (contains --index /usr/local/bin $PATH) | |
if test $local_bin_index -gt $bin_index | |
set --erase $PATH[$local_bin_index] | |
set --local local_path '' | |
if test (math $bin_index - 1) -gt 0 | |
set local_path $PATH[1..(math $bin_index - 1)] | |
end |
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 'date' | |
# Set the expriation to now plus 30 days | |
expriation = Time.now + (30 * 24 * 60 * 60) | |
# Output the filename in the desired format | |
puts expiration.strftime('discourse-%Y-%m-%d.dump') | |
# Or if you want the time too | |
puts expiration.strftime('discourse-%Y-%m-%d-%H-%M-%S.dump') |
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
# Explicitly opens and closes the file | |
def read_file1(filename) | |
file = nil | |
begin | |
file = File.open('somefile.txt') | |
return file.readlines | |
ensure | |
file.close |
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
### | |
# Allowable | |
# | |
# A pattern for decomposing large/long conditional chains | |
# into readable, testable, and inspectable segments. | |
# Code coverage stats can help show you which conditions | |
# aren't getting test coverage, and printing/prying around | |
# the code can show you intermediary condition results. | |
# | |
# Effectively a block-syntax for the `or` operator: each `when?` |
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
Get-Content -Encoding byte test.rb |
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
# Indicates whether `color` is a valid SVG color string. | |
# | |
# [SVG color descriptions](http://www.w3.org/TR/SVG/types.html#DataTypeColor) are one of the following: | |
# | |
# * RGB values | |
# * `#rgb` | |
# * `#rrggbb` | |
# * `rgb(255, 0, 0)` - *not currently supported by KangaRuby* | |
# * `rgb(100%, 0%, 0%)` - *not currently supported by KangaRuby* | |
# * [Color names](http://www.w3.org/TR/SVG/types.html#ColorKeywords) |
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
class A | |
{ | |
private B b; | |
public A(B b) | |
{ | |
this.b = b; | |
} | |
public void store() |