Skip to content

Instantly share code, notes, and snippets.

View remainstheday's full-sized avatar
💻
Working from home

remainstheday remainstheday

💻
Working from home
View GitHub Profile
@remainstheday
remainstheday / declaring_objects_in_Javascript.js
Last active November 17, 2016 23:23
The 3 ways to declare objects in javascript
/*
* 1. USING A FUNCTION
* notes: this is not the best solution for
* large applications, because your constructor
* functions are global objects and could accidentally
* be overwritten.
*/
// create a Class Apple
function Apple(type){
@remainstheday
remainstheday / pixelConversions.scss
Created April 11, 2014 18:24
Fun with SASS mixins
@function strip-unit($num) {
@return $num / ($num * 0 + 1);
}
@mixin rem-fallback($property, $values...) {
$max: length($values);
$pxValues: '';
$remValues: '';
@for $i from 1 through $max {
@remainstheday
remainstheday / blog.server.view.ejs
Created May 26, 2014 23:51
prismic with meanjs.org stack
<div class="col-md-7">
<% for(var i=0; i<posts.results.length; i++) { %>
<div class="blog-post">
<div class="row">
<div class="col-md-1" >
<div class="date"> <%= posts.results[i].getDate("blog.date") %></div>
<li> <img src="../../img/icons/facebook.png" alt="" class="blog-icon"></li>
@remainstheday
remainstheday / prismic-configuration.js
Created May 26, 2014 23:52
prismic configuration
'use strict';
exports.Configuration = {
apiEndpoint: 'https://trinet.prismic.io/api',
// -- Links resolution rules
linkResolver: function(ctx, doc) {
if (doc.isBroken) return false;
@remainstheday
remainstheday / post.server.view.ejs
Created May 26, 2014 23:54
prismic with meanjs.org single post
<div class="main" id="postDetail">
<article>
<%- post.getHtml("blog.body", ctx) %>
</article>
</div>
@remainstheday
remainstheday / media-queries.less
Last active November 22, 2016 19:09
easily include this file into your project then call the breakpoints while writing your styles.css
/* === Responsive Breakpoint Values === */
// XL Breakpoint: 1025px - 1200px; (desktop and up)
// L Breakpoint: 769px - 1024px; (tablet landscape)
// M Breakpoint: 706px - 768px; (tablet portrait)
// S Breakpoint: 481px - 705px; (mobile landscape)
// XS Breakpoint: 320px - 480px; (mobile portrait)
/* === LESS variables === */
@mq-desktop : 1025px;
@mq-tablet-landscape : 769px;
@remainstheday
remainstheday / media-quiries.scss
Created June 22, 2014 06:24
Responsive Breakpoints for SASS
/* === Responsive Breakpoint Values === */
// XL Breakpoint: 1025px - 1200px; (desktop and up)
// L Breakpoint: 769px - 1024px; (tablet landscape)
// M Breakpoint: 706px - 768px; (tablet portrait)
// S Breakpoint: 481px - 705px; (mobile landscape)
// XS Breakpoint: 320px - 480px; (mobile portrait)
/* === SASS variables === */
$mq-desktop : 1025px;
$mq-tablet-landscape : 769px;
@remainstheday
remainstheday / index.html
Created September 30, 2016 16:29
Center html text with a bottom border
<div class="slogan">
<h1>Developing Interactive User Interfaces</h1>
</div>
@remainstheday
remainstheday / images.js
Created November 14, 2016 16:00
Load images after the page has loaded to avoid lag
/**
* This script wrapped in a Immediately-Invoked Function Expression (IIFE) to
* prevent variables from leaking onto the global scope. For more information
* on IIFE visit the link below.
* @see http://en.wikipedia.org/wiki/Immediately-invoked_function_expression
*/
(function() {
'use strict';
@remainstheday
remainstheday / drag.js
Created December 31, 2016 19:40
vanilla javascript drag objects
var selected = null, // Object of the element to be moved
x_pos = 0, y_pos = 0, // Stores x & y coordinates of the mouse pointer
x_elem = 0, y_elem = 0; // Stores top, left values (edge) of the element
// Will be called when user starts dragging an element
function _drag_init(elem) {
// Store the object of the element which needs to be moved
selected = elem;
x_elem = x_pos - selected.offsetLeft;
y_elem = y_pos - selected.offsetTop;