Skip to content

Instantly share code, notes, and snippets.

View aaryan79831014's full-sized avatar

Ramasamy Solaiappan aaryan79831014

View GitHub Profile
@joey-qc
joey-qc / TSQL-to-POCO
Created September 26, 2013 06:56
A simple TSQL script to quickly generate c# POCO classes from SQL Server tables and views. You may tweak the output as needed. Not all datatypes are represented but this should save a bunch of boilerplate coding. USAGE: Run this query against the database of your choice. The script will loop through tables, views and their respective columns. Re…
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
@mavame
mavame / GoogleMapsApi.js
Last active December 6, 2023 21:53
A simple class for loading the Google Maps Javascript API in browser async using ES6 and Promise
/**
* Use this class to ensure Google Maps API javascript is loaded before running any google map specific code.
*/
export class GoogleMapsApi {
/**
* Constructor set up config.
*/
constructor() {
// api key for google maps
@troyhunt
troyhunt / rick-roll-content-scraper.js
Created August 19, 2020 07:41
A Cloudflare worker to redirect image requests from dickhead content scraper's site to a Rick Roll
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
let response = await fetch(request)
let referer = request.headers.get('Referer')
let contentType = response.headers.get('Content-Type') || ''
if (referer && contentType.startsWith('image/')) {
@idevwise
idevwise / focusLoopingUtil.js
Last active October 19, 2022 16:58
Utility to loop focus inside a DOM element
/**
* Selectors for all focusable elements
* @type {string}
*/
const FOCUSABLE_ELEMENT_SELECTORS = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex="0"], [contenteditable]';
const KEY_CODE_MAP = {
TAB: 9
};
@lpdumas
lpdumas / panTo.js
Created September 13, 2012 15:28
Simple pan method for Google map API v3 to pan the map with a certain offset. In this case, used within a custom infoWindow class.
CustomInfoWindow.prototype.panMap = function(marker, map) {
var offsetX = 100
var offsetY = 75
var scale = Math.pow(2,map.getZoom())
var center = map.getProjection().fromLatLngToPoint(marker.getPosition())
var newCenterPoint = new google.maps.Point(
center.x - offsetX/scale,
center.y + offsetY/scale
)
@chrislkeller
chrislkeller / README.md
Last active February 3, 2022 08:02
Displaying data from a flat JSON file on a Handlebars.js template file rendered with AJAX.

Demo: ajax-handlebars

This repo's location has changed.

@dawoe
dawoe / DefaultController.cs
Created November 7, 2017 08:20
Donut Cache examples from Umbraco UK Festival talk "The need for speed"
public class DefaultController : RenderMvcController
{
[UmbracoDonutOutputCache(CacheProfile = "LongPageCache",
Options = OutputCacheOptions.NoCacheLookupForPosts &
OutputCacheOptions.ReplaceDonutsInChildActions, Order = 100)]
public override ActionResult Index(RenderModel model)
{
return base.Index(model);
}
}
@jkarsrud
jkarsrud / BundleInstall.md
Last active May 27, 2020 08:51
How to use ASP.NET Bundling and Minifications in Umbraco

How to use ASP.NET Bundling and Minifications in Umbraco

Using the ASP.NET bundling and minifications is pretty straight forward, but here is a small guide that take care of a few gotchas when implementing bundles in your Umbraco project.

Installing ASP.NET Bundling and Minifications

ASP.NET Bundling and Minifications is part of the Microsoft ASP.NET Web Optimization Framework and is installed via NuGet;

PM> Install-Package Microsoft.AspNet.Web.Optimization

Once this is done, you need to create a BundleConfig.cs in your App_Start1 folder. This is where you register your different bundles. It can be extremely simple, or it can be more complex, but the gist of it is this;

@rustyswayne
rustyswayne / gist:777ed32802124f9d2557
Created December 23, 2014 00:55
Merch-v6 Simple ExamineSettings.config
<?xml version="1.0"?>
<!--
Umbraco examine is an extensible indexer and search engine.
This configuration file can be extended to add your own search/index providers.
Index sets can be defined in the ExamineIndex.config if you're using the standard provider model.
More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
-->
<Examine>
<ExamineIndexProviders>
@rustyswayne
rustyswayne / gist:6d1d75ee29dc8f0f6f67
Created December 23, 2014 00:56
Merch-v6 Simple ExamineIndex.config
<?xml version="1.0"?>
<!--
Umbraco examine is an extensible indexer and search engine.
This configuration file can be extended to create your own index sets.
Index/Search providers can be defined in the UmbracoSettings.config
More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
-->
<ExamineLuceneIndexSets>
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->