Skip to content

Instantly share code, notes, and snippets.

@kensykora
kensykora / validate-site-html.ps1
Created May 28, 2014 14:38
W3C HTML Sitemap-based Site Validator
param ([Parameter(Mandatory=$True)][string]$SitemapUrl,
[int]$Max=0)
function Validate($url) {
if(-not $url.StartsWith("http")) {
$parsed = [System.Uri]$SitemapUrl
$url = "{0}://{1}{2}" -f $parsed.Scheme, $parsed.Host, $url
}
@weshardee
weshardee / .scss-lint.yml
Last active August 29, 2015 14:10
My SCSS lint preferences
# Docs @ https://github.com/causes/scss-lint/blob/master/lib/scss_lint/linter/README.md
linters:
BorderZero:
enabled: false # nerdery - no existing standard for 'none' or '0'
CapitalizationInSelector:
enabled: false # nerdery - capitalization in camelCase is possible
ColorKeyword:
@k33g
k33g / kind.js
Created April 2, 2012 20:29
Re Use Object Model of BackBone
// Just do this : (and include backbone.js)
var Kind = function() {
this.initialize && this.initialize.apply(this, arguments);
};
Kind.extend = Backbone.Model.extend
//Simpler
var Thing = function() {};
Thing.extend = Backbone.Model.extend
@SgtPooki
SgtPooki / CreateElement
Last active March 4, 2017 08:36
Create element function that makes the best of jquery and javascript. Will convert to jquery plugin and test speed there as well. You can check results of speed tests here: http://jsperf.com/building-dom-items/2. Plan is to make this function the method to use when creating elements so that it is always the fastest and most browser compatible me…
/*
Sample object that should work is:
var exampleObj = {
tag: 'div',
attr: {
id: '1234',
href: 'some/url/path',
class: ['createdElement', 'example', 'parent'],
text: 'some text'
},
@SgtPooki
SgtPooki / getFreeOreillyBooks.js
Last active June 7, 2019 18:45
Script to automatically download free ebooks listed on oreilly
/*
Just paste into your console.. or make a tampermonkey/greasemonkey script out of it.
Only tested in Chrome. Be careful.. three tabs are opened per book.
If a books image is not removed, you'll need to try to download that book yourself.
Use this script (enter into the console of your browser) on the following pages:
http://www.oreilly.com/programming/free/
http://www.oreilly.com/business/free/
SHOW_PRINTING_AIDS = true;
MINIMUM_LAYER_HEIGHT = .2;
SHOW_CROSS_SECTION = false;
CROSS_SECTION_LENGTH = 10;
CROSS_SECTION_ROTATION = 30;
lid_wall = 1.8;
lip_and_pot_clearance = 5;
@ednisley
ednisley / Vacuum Hose Fittings.scad
Created July 1, 2016 23:50
OpenSCAD source code: shop vacuum adapters for PVC pipe fittings
// Vacuum Hose Fittings
// Ed Nisley KE4ZNU July 2016
Layout = "FVacFitting"; // PVCtoHose ExpandRing PipeToPort FVacPipe FVacFitting
//- Extrusion parameters must match reality!
// Print with 2 shells and 3 solid layers
ThreadThick = 0.25;
ThreadWidth = 0.40;
@sevcsik
sevcsik / nodejs-angularjs-common-modules.md
Last active February 15, 2022 09:38
Sharing modules between NodeJS and AngularJS

They say that one of the pros of NodeJS is that you use the same language on the back-end and the front-end, so it's easy to share code between them. This sounds great in theory, but in practice the synchronous dependency handling in NodeJS works completely different than any client-side frameworks (which are asynchronous).

Usually that means that you end up copy-pasting your code between your NodeJS sources and your client-side sources, or you use some tool like Browserify, which is brilliant, but they add an extra step in the build process and most likely will conflict with the dependency handling of the framework of your choice (like AnularJS DI). I couldn't look in the mirror if I would call that code sharing.

Fortunately, with a couple of lines of boilerplate code, you can write a module which works in NodeJS and AngularJS as well without any modification.

No globals in the front-end, and dependencies will work. The isNode and isAngular va

@vojtajina
vojtajina / all-templates.html
Created August 15, 2012 00:00
AngularJS: load all templates in one file
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
@sunnywalker
sunnywalker / html-table-to-markdown-extra.html
Last active August 3, 2022 12:09
HTML Table to Markdown Extra converter
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Table to Markdown Extra Table</title>
<style>
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;}
body { font-family: -apple-system, "Segoe UI", Arial, Helvetica, sans-serif; line-height: 1.5;
text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
textarea { width: 100%; height: 15em; }