Skip to content

Instantly share code, notes, and snippets.

View bluehazetech's full-sized avatar

Brian Turgeon bluehazetech

View GitHub Profile
@bluehazetech
bluehazetech / jquery-external-links
Created April 6, 2014 15:54
jQuery: External Links Open in New Window
@bluehazetech
bluehazetech / jquery-numeric-values
Created April 6, 2014 15:53
jQuery: Get Elements that Contain Numeric Values
$('div').filter(function() {
return this.innerHTML.match(/^\d+$/);
});
@bluehazetech
bluehazetech / javascript-get-selected-option
Created April 6, 2014 15:48
JavaScript: Get Selected Option
// Select an option based on index:
$('#selectBox option')[index].attr('selected', 'selected');
// Select an option based on value:
$('#selectBox option[value=value]').attr('selected', 'selected');
@bluehazetech
bluehazetech / jquery-hasparent
Created April 6, 2014 15:45
jQuery: hasParent Selector Function
/*
* Test whether argument elements are parents of the first matched element
* @return boolean
* @param objs
* a jQuery selector, selection, element, or array of elements
*/
$.fn.hasParent = function(objs) {
// ensure that objs is a jQuery array
objs = $(objs); var found = false;
$(this[0]).parents().andSelf().each(function() {
@bluehazetech
bluehazetech / dotfile-bashrc-windows
Created March 31, 2014 00:41
Dotfile: bashrc (Windows)
# Note: ~/.ssh/environment should not be used, as it
# already has a different purpose in SSH.
env=~/.ssh/agent.env
# Note: Don't bother checking SSH_AGENT_PID. It's not used
# by SSH itself, and it might even be incorrect
# (for example, when using agent-forwarding over SSH).
agent_is_running() {
@bluehazetech
bluehazetech / dotfile-gitconfig
Created March 31, 2014 00:40
Dotfile: gitconfig
[color]
ui = auto
[push]
default = simple
[mergetool "sublime"]
cmd = subl -w $MERGED
trustExitCode = false
[merge]
tool = sublime
[core]
@bluehazetech
bluehazetech / dotfile-sublime-settings
Last active August 29, 2015 13:57
Dotfile: Sublime Settings
{
"binary_file_patterns":
[
"humans.txt",
"robots.txt",
"*jquery*.js",
"*.min.js"
],
"caret_style": "blink",
"color_scheme": "Packages/User/Tomorrow-Night (SL).tmTheme",
@bluehazetech
bluehazetech / dotfile-gitignore
Created March 30, 2014 01:50
Dotfile: gitignore
*.sublime-*
!.gitkeep
bin
dist
logs/*
node_modules/
tmp
.DS_Store
.idea
.sass-cache
@bluehazetech
bluehazetech / css-svg-images
Created March 25, 2014 12:27
CSS: SVG Images
<!-- inline SVG with inline fallback -->
<object data="image.svg" type="image/svg+xml">
<img src="image.png" />
</object>
<!-- inline SVG with CSS fallback using Modernizr -->
<object data="image.svg" type="image/svg+xml" class="svg">
SVG Image <!-- CSS fallback image -->
</object>
@bluehazetech
bluehazetech / css-scrollbar
Last active August 29, 2015 13:57
CSS: Scrollbar
@media only screen and (min-width: 767px) {
::-webkit-scrollbar {
width: 12px;
height: 12px;
background-color: $xxLightGrey;
}
::-webkit-scrollbar-thumb {
background-color: $darkBlue;
-webkit-border-radius: 5px;
}