Skip to content

Instantly share code, notes, and snippets.

View javafun's full-sized avatar

Vincent javafun

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text.RegularExpressions;
using System.Web.Mvc;
using System.Web.Mvc.Html;
namespace System.Web.Mvc.Html
{
public class ImportedFilePathResolver : IPathResolver
{
private string currentFileDirectory;
private string currentFilePath;
/// <summary>
/// Initializes a new instance of the <see cref="ImportedFilePathResolver"/> class.
/// </summary>
/// <param name="currentFilePath">The path to the currently processed file.</param>
public ImportedFilePathResolver(string currentFilePath)
@javafun
javafun / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!--
Usage:
1. Download this file into your project folder, named it as "Less.targets"
2. Use notepad to open your project file (e.g. Example.csproj), and put following code to above of end element 'Project'.
<Import Project="Less.targets" />
3. Change element type of *.less file in your project file to "LessCompile".
You need to do that manual first time. After that, you can change the file's "build action" to 'LessCompile' through PropertyGrid.
4. Close notepad and reload your project in VisualStudio. Then press F6 to build your project.
You will found the css file will be generated by build process automatically.
-->
/// <summary>
/// Verifies the controller action, contains an attribute of the specified attributeType.
/// </summary>
/// <param name="controller">The controller.</param>
/// <param name="action">The action method.</param>
/// <param name="attributeType">Type of the attribute to look for.</param>
/// <returns>Returns true if the attribute was present on the action. Otherwise false.</returns>
public static bool VerifyControllerActionAttribute(this Controller controller, Func<ActionResult> action, Type attributeType)
{
MethodInfo methodInfo = action.Method;
using EPiServer;
using EPiServer.Core;
using EPiServer.ServiceLocation;
namespace Core.Properties
{
public static class PropertyFinder
{
public static T FindProperty<T>(PageData currentPage, string propertyName)
using EPiServer.Shell;
namespace Meridium.UIDescriptors
{
[UIDescriptorRegistration]
public class PageDataUIDescriptor: UIDescriptor<PageData>
{
public BasePageUIDescriptor()
{
DefaultView = CmsViewNames.AllPropertiesView;
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
mvn archetype:generate -DarchetypeRepository=http://repo.adobe.com/nexus/content/groups/public/ -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.2 -DgroupId=com.aem.community -DartifactId=echoproject -Dversion=1.0-SNAPSHOT -Dpackage=com.aem.community -DappsFolderName=myproject -DartifactName="My Project" -DcqVersion="5.6.1" -DpackageGroup="My Company"
@javafun
javafun / gist:53c6848ebabdf51b966c
Last active August 29, 2015 14:25
eclipse shortcuts
cmd + shift + L //Show All Shortcuts
cmd + F // Find and replace
Shortcut Key Mac Shortcut Key Windows Description
Command + 3 Ctrl + 3 In Eclipse Juno, puts the focus into Quick Access search box, in older eclipse opens quick access dialog.
Command + S Ctrl + S Save current editor
Command + 1 Ctrl + 1 Quickfix for errors and warnings, depends on the cursor position
Control + Space Ctrl + Space Content assist and code completion
Command + Shift + F Ctrl + Shift + F Format source code
Control + Q Ctrl + Q Moves cursor to the last edited position