Skip to content

Instantly share code, notes, and snippets.

@ashcdev
ashcdev / comma-snippet.js
Created February 4, 2019 15:38
Convert Checkboxes or Similar into Comma Separated list
var checkedVals = $('input[type=checkbox]:checked').map(function() {
return this.value;
}).get();
$(*TARGET*).val(checkedVals.join(","));
@joseluisq
joseluisq / stash_dropped.md
Last active March 28, 2024 11:59
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
@AntMooreWebDev
AntMooreWebDev / HTML5-Template.html
Last active May 11, 2020 20:35
An empty HTML5 template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="IE=edge,chrome=1' http-equiv='X-UA-Compatible">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title></title>
<!--css here-->
<!--<link rel="stylesheet" type="text/css" href="/css/style.css">-->
</head>
@AntMooreWebDev
AntMooreWebDev / FireEventsOnDynamicElement.js
Last active December 2, 2019 16:29
The generic code for firing events on elements that are loaded dynamically. This is particularly useful if the elements are generated by a plugin and you cannot utilise CreateDynamicElements.js (https://gist.github.com/AntMooreWebDev/bbd29b7f5298409dba12aed9a71ee81b).
$('body').on('[event]', '[element]', function () { });
@sergeyt
sergeyt / cors.global.asax
Created October 16, 2013 15:19
global.asax to enable CORS on IIS server
<%@ Application Language="C#" %>
<script runat="server">
void Application_BeginRequest(object sender, EventArgs e)
{
var context = HttpContext.Current;
var response = context.Response;
// enable CORS
response.AddHeader("Access-Control-Allow-Origin", "*");
@bhays
bhays / Typeahead-BS3-css
Created August 2, 2013 13:54
Bootstrap 3 style fixes for using Typeahead.js
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;
font-size: 14px;
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}