Skip to content

Instantly share code, notes, and snippets.

View simevidas's full-sized avatar
🦊
sticking with Firefox till the end

Šime Vidas simevidas

🦊
sticking with Firefox till the end
View GitHub Profile
@simevidas
simevidas / gist:6708899
Last active December 23, 2015 23:19 — forked from miketaylr/gist:6701828
<script>
if (screen.width <= 640) document.write('<meta name="viewport" content="width=device-width, initial-scale=1">');
</script>
@simevidas
simevidas / gist:4695d65f6f193fa2821d
Last active December 25, 2015 03:24
Updated Autoprefixer before/after
/*
YUI 3.14.1 (build 63049cb)
Copyright 2013 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
/*
TODO will need to remove settings on HTML since we can't namespace it.
TODO with the prefix, should I group by selector or property for weight savings?
<script>
(function () {
google.maps.event.addDomListener(window, 'load', init);
var map;
function init() {
var mapOptions = {
center: new google.maps.LatLng(45.8167,15.9833),
zoom: 2,
<!doctype html>
<html>
<head>
<title>Tabs Demo!</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
.container {
margin-top: 20px;
}
@simevidas
simevidas / gist:8272443
Last active January 2, 2016 07:49
Creating the MongoDB URL in a Node web app on AppFog
// This is my refactored version of the code available in AppFog’s documentation here:
// https://docs.appfog.com/services/mongodb#node
// The version string is passed to the IIFE as an argument ('mongodb2-2.4.8' in my case)
var mongourl = (function (mongo_version) {
var VCAP = process.env.VCAP_SERVICES;
var obj = VCAP ? JSON.parse(VCAP)[mongo_version][0].credentials : {};
return [

##Transform JSX/ES 2015 during development using Babel-cli and npm scripts

This setup involves using the Babel-cli, Babel presets/plugins, and npm scripts to transform JSX/ES 2015 to ES5 code during development.

We'll create this setup in seven steps.

Step 1: Install Node.js, npm, and browser-sync globally

In this step make sure you have installed or have the most recent stable version of Node.js and npm. Then run the following command to install browser-sync.

@simevidas
simevidas / concept.md
Last active May 13, 2016 00:54
A JS library that makes PAGE UP/DOWN keys work better on web sites (concept)

A JS library that makes PAGE UP/DOWN keys work better on web sites (concept)

  • the web page is divided (vertically) into logical sections
  • when the user presses PAGE DOWN,
    • if the current section is completely visible, the page is scrolled to the beginning of the next section
    • else, the page is scrolled so that more of the current section is revealed (this goes on until the end of the current section is visible)
  • when the user presses PAGE UP, the same algorithm applies but in the opposite direction
  • optionally, a visual indicator of where the current section begins/ends may also be displayed (e.g. a vertical stripe at the left edge of the viewport)

Note: I looked into the CSS Scroll Snap module, but the spec is currently undergoing a major refactoring.

@simevidas
simevidas / index.js
Created May 29, 2016 18:33
requirebin sketch
var Mailgen = require('mailgen');
// Configure mailgen by setting a theme and your product info
var mailGenerator = new Mailgen({
theme: 'default',
product: {
// Appears in header & footer of e-mails
name: 'Mailgen',
link: 'https://mailgen.js/'
// Optional product logo

Diary:

  1. Foo

  2. Bar

  3. Baz

/*
YUI 3.14.1 (build 63049cb)
Copyright 2013 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
/*
TODO will need to remove settings on HTML since we can't namespace it.
TODO with the prefix, should I group by selector or property for weight savings?