Skip to content

Instantly share code, notes, and snippets.

View carlwoodhouse's full-sized avatar

Carl Woodhouse carlwoodhouse

View GitHub Profile
@carlwoodhouse
carlwoodhouse / gist:4754051
Created February 11, 2013 11:51
radio, do something when selected value changes
$("#marksradio").change(function () {
var selectedValue = $("#marksradio option:selected").val(); // or .text();
// do some shit with selectedValue
})
<httpErrors existingResponse="Replace" errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/404.aspx" responseMode="ExecuteURL" />
</httpErrors>
// in theme functions.php
<?php
add_action('gform_after_submission', 'createPaymentForm', 10, 2);
function createPaymentForm($entry, $form) {
$valuesFound = false;
$fieldId = -1;
$fieldTotalId = -1;
$fieldCounter = 0;
@carlwoodhouse
carlwoodhouse / gist:8581198
Created January 23, 2014 16:04
scp cheat sheet
# copy from local machine to remote machine
scp localfile user@host:/path/to/whereyouwant/thefile
# copy from remote machine to local machine
scp user@host:/path/to/remotefile localfile
@carlwoodhouse
carlwoodhouse / sql-dupes-to-delete
Created January 15, 2015 16:18
sql duplicates to delete
DELETE FROM dbo.Orchard_MediaProcessing_FileNameRecord
WHERE id in (
SELECT id
FROM (
SELECT
path, id,
ROW_NUMBER() OVER (PARTITION BY path ORDER BY id) AS intRow
FROM dbo.Orchard_MediaProcessing_FileNameRecord
) AS d
WHERE intRow != 1
using Orchard;
using Orchard.Caching;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions;
using Orchard.Mvc.Filters;
using Orchard.OutputCache.Filters;
using Orchard.OutputCache.Services;
using Orchard.Services;
using Orchard.Themes;
using Patient.Core.Extensions;
<location path="route">
<system.web>
<httpHandlers>
<add path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" />
</httpHandlers>
</system.web>
<!-- Required for IIS 7.0 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
private readonly ISuesService suesService;
// current
void SuesController(ISuesService ss)
{
this.suesService = ss;
}
// without di
void SuesController()
var contentItemIdsByLetter = this.cacheManager.Get(
string.Concat("Patient.Contenttypes.Az.Ids.For.", letter),
ctx => {
ctx.Monitor(this.clock.When(Timespan.FromDays(1)));
return this.letterRepository.Fetch(x => x.Title.StartsWith(letter)).toList();
}
var items = this.cacheManager.Get(
string.Concat("Patient.Contenttypes.Az.Items.For.", letter, ".By.", contentType),
ctx => {
var contentAzDefinitions = this.cacheManager.Get(
string.Concat("Patient.Contenttypes.Az.Ids.For.", letter),
ctx => {
ctx.Monitor(this.clock.When(Timespan.FromDays(1)));
var titleDefinitions = this.letterRepository.Fetch(x => x.Title.StartsWith(letter)).toList();
var content = this.contentManager.GetMany(titleDefinitions.Select(x => x.ContentItemId), VersionOptions.Published);
var items = new List<AzLinkDefinition>();
foreach(var titleDefinition in titleDefinitions)
{