Skip to content

Instantly share code, notes, and snippets.

View ryanve's full-sized avatar
🟣
🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣

ryan neptune ryanve

🟣
🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣🟣
View GitHub Profile
@ryanve
ryanve / truncate.css
Created June 22, 2016 17:49
truncate text in css
.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.untruncate {
overflow: visible;
text-overflow: initial;
white-space: pre;
@ryanve
ryanve / remove-comment-nodes.js
Created August 12, 2016 01:28
remove comment nodes from the DOM
$(':not(iframe)').contents().each(function() {
8 == this.nodeType && $(this).remove()
})
@ryanve
ryanve / border.scss
Created August 26, 2016 20:38
sass border side mixin
@mixin border($side: null) {
#{if($side, border-#{$side}, border)}: 2px solid;
}
@ryanve
ryanve / compute.js
Last active September 17, 2016 21:07
Compute and display an element's CSS properties
$('[data-compute]').each(function() {
$(this).text($(this.dataset.computeFrom).css(this.dataset.compute));
});
@ryanve
ryanve / backdrop.scss
Last active November 23, 2016 19:04
Sass backdrop mixin
@mixin backdrop($background: rgba(black, .5)) {
@include mask(fixed);
z-index: -1;
background: #{$background};
}
@ryanve
ryanve / clone-click.js
Created September 27, 2016 20:41
Angular clone-click directive
/**
* @ngdoc directive
* @restrict A
* @description Clone descendent click. Clicking [rad-clone-click] triggers click on associated selector.
* @element ANY
* @example
* <ANY clone-click=".is-clone-click:not(:disabled):not(.is-disabled)">
* <a class="is-clone-click" ui-sref="root.example">example</a>
* </ANY>
*/
@ryanve
ryanve / mask.hbs
Created September 27, 2016 22:59
Link masking example
<article class="is-relative">
<a class="is-mask" aria-label="permalink" href="#example"></a>
<h1 class="is-mask-label">Example title</h1>
<p>Clicking anywhere here should navigate to #example</p>
<figure class="is-behind">
Add <code>.is-behind</code> as needed to drop elements behind the mask
</figure>
<fieldset>
<button>example button should not navigate</button>
<button disabled>disabled button should not navigate</button>
@ryanve
ryanve / readJsonSync.js
Created October 7, 2016 17:39
node readJsonSync function
function readJsonSync(file) {
return JSON.parse(require('fs').readFileSync(file, 'utf8'))
}
@ryanve
ryanve / run-capture.js
Created October 7, 2016 19:18
run CLI commands in node.js
var child_process = require('child_process')
function run(command) {
return child_process.execSync(command)
}
function capture(command) {
return String(run(command)).trim()
}
@ryanve
ryanve / argValue.js
Last active October 7, 2016 19:47
get value from key=value string
module.exports = function argValue(key) {
function value(arg) {
return null == arg ? arg : 0 === arg.indexOf(key + '=') ? arg.slice(key.length + 1) : arg === key
}
return value(this[this.findIndex(value)])
}