Skip to content

Instantly share code, notes, and snippets.

View mojaray2k's full-sized avatar

Amen Moja Ra mojaray2k

  • Miami, Fl
View GitHub Profile
@mojaray2k
mojaray2k / Social_Menu_Items_Styled_By_URL.markdown
Created August 15, 2014 05:47
Target Links to style by their url using the href attribute

You can still social media links or any links by using a url

Use ths jsp filter to remove extra elements that are automatically inserted in by default

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@mojaray2k
mojaray2k / smoothscrolling.js
Last active August 29, 2015 14:05
Smooth Scrolling Effect
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
@mojaray2k
mojaray2k / trim.js
Created August 23, 2014 08:32
Just like the trim() function in PHP (and probably many other languages), JavaScript's trim() returns the value of the string with any white space removed from the beginning and end.
var a = " example "; console.log(a.trim()); // output: "example"
//IE Polyfill
if (!String.prototype.trim) { String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }; }
@mojaray2k
mojaray2k / functionscope.js
Last active August 29, 2015 14:06
You’ll want to wrap your code into an anonymous function and then immediately call it, when you want some encapsulation. There are only two types of scopes in JavaScript (but look at ECMA6 block scopes): global scope and function scope. Everything you write goes into global scope, which is accessible from everywhere. This includes vars and funct…
(function() {
function div(a, b) {
return a / b;
}
function divBy5(x) {
return div(x, 5);
}
window.divBy5 = divBy5;
@mojaray2k
mojaray2k / mouseevents.css
Last active August 29, 2015 14:06
Tracking Mouse Events// source http://jsbin.com/modipa/1
body {
font-family: Arial, sans-serif;
padding: 20px;
text-align: center;
}
button {
margin-bottom: 40px;
}
@mojaray2k
mojaray2k / detectie10and11.css
Created October 2, 2014 15:45
Just pop the above media query in your css and you can now override and adjust CSS just for IE10 and IE 11.
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* IE10+ specific styles go here */
}
@mojaray2k
mojaray2k / modulePattern.js
Last active August 29, 2015 14:07
Module Pattern Example
var dom = (function($) {
var _counter = 0;
function generateId(){
return "customId" + _counter++;
}
function create(tagName, id) {
var el = document.createElement(tagName);
@mojaray2k
mojaray2k / dabblet.css
Last active August 29, 2015 14:07 — forked from basher/dabblet.css
/**
* CSS3 tabbed interface
* - based on http://www.sitepoint.com/css3-tabs-using-target-selector/
* - 1st tab is LAST in markup:
* - so it can be styled as active on page load
* - use combination of :target and ~ to override when another tab is clicked
*/
body {
font: 62.5%/1.5 Georgia,serif;
margin: 10em 0 0;