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
validates_inclusion_of :time_zone, in: ActiveSupport::TimeZone.us_zones.map { |z| z.name }, | |
message: "is not a valid time zone", | |
allow_blank: true | |
# This allows me to display the time_zone as a dropdown in rails admin instead of a text box | |
TIMEZONES = ActiveSupport::TimeZone.us_zones.map { |z| z.name } | |
def time_zone_enum | |
TIMEZONES.each_with_index.to_a | |
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
{ | |
id: ch_16y7ULJIRogBQY6KCRms4GAZ | |
object: "charge" | |
amount: 3344 | |
amount_refunded: 0 | |
application_fee: null | |
balance_transaction: "txn_16y7ULJIRogBQY6KGAKRKRmm" | |
captured: true | |
created: 1445375865 | |
currency: "cad" |
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 MyService | |
def initialize user, card, pricing_service | |
@user = user | |
end | |
end | |
# Initialize | |
MyService.new(current_user) | |
# Trying to return value outside controller, maybe in the console for example |
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 Availability < ActiveRecord::Base | |
# Associations | |
belongs_to :facility | |
has_one :venue, through: :facility | |
# Scopes for search filters | |
scope :close_to, -> (venues) {where{facility.venue_id.in venues}} | |
scope :activity, -> (activity) {where{facility.activities.name.in activity}} | |
scope :start_date, -> (datetime) {where{ start_time >= datetime }} |
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
<%-- The following 4 lines are ASP.NET directives needed when using SharePoint components --%> | |
<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %> | |
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> | |
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> | |
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> | |
<%-- The markup and script in the following Content element will be placed in the <head> of the page --%> | |
<asp:Content ContentPlaceHolderID="PlaceHolderAddition |
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
var GetSites = function () { | |
var allSites = [] | |
var d = $.Deferred(); | |
//MAKE CALL FOR ALL SITES | |
var getCollectionSites = $().SPServices({operation: "GetAllSubWebCollection"}); | |
//HANDLE CALL PROMISE | |
getCollectionSites.then(success,fail); | |
//EXTRACT NECESSARY PROPERTIES FROM RESPONSE | |
function success(resolve) { | |
var result = $(resolve); |
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
// Update files | |
function updateItems (isTrue) { | |
// Get selected files from list | |
var selectedItems = SP.ListOperation.Selection.getSelectedItems().map(x => x.id) | |
var myFieldValue = isTrue ? "true" : "false"; | |
var batch = $pnp.sp.createBatch(); // Create batch object | |
var fileRefs = []; // Store selected files reference | |
var documentLibrary = $pnp.sp.web.lists.getByTitle("Documents"); // Get document library | |
// Get fileRef from selected items |
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
/* | |
* HillbillyTabs.2013 - Place SharePoint 2013 Web Parts in Tabs | |
* Version 3.0 | |
* @requires jQuery v1.7 or greater | |
* @requires jQueryUI v1.11 or greater | |
* @requires jQuery.cookie | |
* | |
* Copyright (c) 2013-2015 Mark Rackley | |
* Licensed under the MIT license: | |
* http://www.opensource.org/licenses/mit-license.php |
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 working group files | |
getFiles: function(id) { | |
var d = $.Deferred(); | |
var opts = { | |
listName: "WgDocuments", | |
CAMLQuery: "<Query><OrderBy><FieldRef Name='Created' Ascending='False'/></OrderBy><Where><And><Eq><FieldRef Name='FSObjType' /><Value Type='Integer'>0</Value></Eq><IsNotNull><FieldRef Name='ID' /></IsNotNull></And></Where></Query>", | |
CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='RecursiveAll' /></QueryOptions>", | |
CAMLRowLimit: 5 | |
} |