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
# app/controllers/concerns/json_default.rb | |
# USAGE: | |
# Simply include into a controller that should be restricted to JSON format: | |
# `include JSONDefault` | |
module JSONDefault | |
extend ActiveSupport::Concern | |
included do | |
before_action :set_default_format, :assert_valid_format! |
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
sudo $(rbenv which passenger-install-nginx-module) |
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
# config/email.yml | |
--- | |
test: | |
:delivery_method: :test | |
:url_host: 'localhost:3000' | |
development: | |
:delivery_method: :smtp | |
:host: "localhost:1025" | |
production: | |
:delivery_method: :smtp |
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
package com.company.sample.widgets; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/** | |
* FittedImageView | |
* @extends ImageView | |
* |
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
/* load_from_arcgis_server | |
* Loads JSON from ArcGIS DOC Tracks server, then parses | |
* it to get tracks path data in turn | |
*/ | |
(function() { | |
var http = require('http'); | |
var fs = require('fs'); | |
function queryLayer(callback) { |
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
for folder in folder1 folder2 folder3; do mv "$folder/_file_old.html.erb" "$folder/_file_new.html.erb"; done |
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
has_one :previous_membership, -> { | |
paid | |
.where(member_id: self.member_id) | |
.where('activated_at < ?', self.activated_at) | |
.order('activated_at DESC') | |
}, class_name: 'Membership' |
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
json.(member, :contact_number, :gender, :date_of_birth, *Member.communication_preferences) |
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
$.fn.exportToCsv = -> | |
export_element = $( $(this).data('export-target') ) | |
csv_string = csvStringFrom(export_element) | |
if Blob | |
$(this).prop( | |
download: csvFilename(), | |
href: URL.createObjectURL(new Blob([csv_string], type: 'text/csv')) | |
) | |
else |
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
module DateHelper | |
def date_from_date_select_params(date_params, key) | |
string_from_date_select_params(date_params, key).to_date | |
end | |
def date_time_from_date_time_select_params(date_params, key) | |
string_from_date_select_params(date_params, key).to_datetime | |
end |