Skip to content

Instantly share code, notes, and snippets.

@ashgadala
ashgadala / fn_htmlencode.sql
Created December 26, 2024 21:54 — forked from azcoov/fn_htmlencode.sql
SQL HTML Encoding
create function dbo.fn_HtmlEncode (
@Html as varchar ( max )
)
returns varchar ( max )
as
/*
select dbo.fn_HtmlEncode('<This is a T&st #>')
*/
@ashgadala
ashgadala / README.md
Created February 12, 2021 15:32 — forked from bollwyvl/README.md
A fishbone editor
  • Make a bulleted Markdown list in the top left to update the list
  • Press edit to hide the editor
  • Press save to use [SVG Crowbar][crowbar] to save a copy
  • Click to drag nodes

This is an integration of [this implementation][orig] of a [Fishbone or Ishikawa][ish] diagram, which shows contributions of different levels of a hierarchy to a main concept, with a Markdown editor for making quick diagrams.

The diagram is implemented in [d3.js][d3], while rich-text editing is provided by [CodeMirror][cm], and [marked][mkd] handles Markdown processing.

@ashgadala
ashgadala / git-pushing-multiple.rst
Created November 18, 2018 15:12 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@ashgadala
ashgadala / combining-git-repositories.md
Created November 17, 2018 00:37 — forked from msrose/combining-git-repositories.md
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@ashgadala
ashgadala / AccountController.cs
Created March 10, 2018 07:58 — forked from hikalkan/AccountController.cs
User Impersonation for ASP.NET Boilerplate
/* SAMPLE AJAX CALL to this action:
(This is enough since it's automatically redirected to the target tenant's ImpersonateSignIn action)
abp.ajax({
url: abp.appPath + 'Account/Impersonate',
data: JSON.stringify({
tenantId: 1, //Target tenant id (can be null if target user is a host user)
userId: 2 //Target user id
})
@ashgadala
ashgadala / exporting-multiple-charts-on-the-page-to-a-single-pdf.markdown
Last active July 28, 2016 01:54
Exporting multiple charts on the page to a single PDF

Edit: this trick stopped working as of Firefox 30 realeased in 2014-06-10. Join the comments section to help finding an alternative, and please upvote the bug on Bugzilla for a definitive fix. If you now have double arrows on Firefox, this might solve your issue.

Don't use any other value of -moz-appearance as the styles inherited are not customisable.


How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

@ashgadala
ashgadala / gist:2891499
Created June 7, 2012 20:59 — forked from JeffreyWay/gist:2889230
Simple PHP Quiz
// Fun little quiz
Assuming this string: "January 5th, 2012"
In the shortest amount of code possible, place:
- 'January' within a $month variable
- '5th' within a $day variable
- '2012' within a $year variable.
// jQuery.FullScreen plugin
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
function isFullScreen() {
return document[!prefix ? 'fullScreen' :
'webkit' === prefix ? 'webkitIsFullScreen' :
prefix + 'FullScreen'];
}