Skip to content

Instantly share code, notes, and snippets.

View Sysetup's full-sized avatar
🚀

Carlos H. Ramírez. Sysetup

🚀
View GitHub Profile
@Sysetup
Sysetup / callback.js
Created October 10, 2016 23:44
Basic callback examples
var l = 5,
b = 5;
function sayHello(greeting){
greeting(function(){
return 'Hello world'
});
}
function area1(x,y,callback){
@Sysetup
Sysetup / fallback.js
Created October 4, 2016 23:28
Fallback
function foo(bar) {
var bar = bar || 0; //This sets bar to 0 if it's not already set
console.log(bar);
}
foo();
foo(1);
@Sysetup
Sysetup / config.js
Created October 4, 2016 22:19
Basic access to objects and JSON data.
var config1 = {
local: {
mode: 'local',
port: 3000,
mongo: {
host: '127.0.0.1',
port: 27017
},
connect : [3,2,1,0],
'sock' : [3,2,1,0]
@Sysetup
Sysetup / app.js
Created October 2, 2016 19:59
Render HTML files with ExpressJS
app.get('/',function(req,res){
res.sendFile('index.html');
});
@Sysetup
Sysetup / index.html
Last active September 2, 2016 06:26
Basic media quieries.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<section>
@Sysetup
Sysetup / GoogleMap.js
Last active August 28, 2016 22:12
Simple Google Map.
(function initMap() {
var contentString = '<div id="content">'+
'<div id="bodyContent">'+
'<p><h3>Sysetup.com</h3>' +
'<address class="md-margin-bottom-40">'+
'<i class="fa fa-phone"></i> <a href="tel:+573116417210">COL: (+57) 311 641 7210 </a> <br>'+
'<i class="fa fa-phone"></i> <a href="tel:+573209004589">COL: (+57) 320 900 4589 </a> <br>'+
'<i class="fa fa-home"></i> Cll 2 14-02, 630004 Armenia Q. Colombia. <br>'+
'<i class="fa fa-envelope"></i> <a href="mailto:contact@sysetup.com">contact@sysetup.com</a>'+
'</address>'+
@Sysetup
Sysetup / GoogleMap.js
Created August 28, 2016 22:00
Simple embed Google Map example.
/*
Steps:
1. Go to: http://map.google.com
2. Pin whatever point in the map.
3. Menu/Share or embed map.
*/
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3977.2854808824613!2d-75.66567468522176!3d4.5425483442734!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x8e38f4ff13a056e9%3A0x78c9afbeed619948!2sSYSETUP!5e0!3m2!1sen!2sco!4v1472421311744" width="2200" height="300" frameborder="0" style="border:0" allowfullscreen>
</iframe>
@Sysetup
Sysetup / removeUrlExtension.js
Created August 19, 2016 16:53
Remove .html from url in a static website
var url = window.location.href;
url = url.split('.html')[0];
//url = url.substring(0, url.lastIndexOf("."));
window.history.replaceState( null, null, url );
@Sysetup
Sysetup / BeforeCloseBrowserWindow.js
Last active July 19, 2016 23:30
Before close browser window JavaScript
$(window).on('beforeunload', function (){
//code...
return false;
})
@Sysetup
Sysetup / Vertical<div>center.js
Created July 19, 2016 23:27
Vertical <div> center
jQuery(document).ready(function() {
App.init();
PageComingSoon.initPageComingSoon();
$('body').css('margin-top', Number($(document).height() - $('.coming-soon-v3').height())/2);
$(window).resize(function() {
$('body').css('margin-top', Number($(document).height() - $('.coming-soon-v3').height())/2);
});
});