Skip to content

Instantly share code, notes, and snippets.

View Sysetup's full-sized avatar
🚀

Carlos HRG. Sysetup

🚀
View GitHub Profile
@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 / 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 / app.js
Created October 2, 2016 19:59
Render HTML files with ExpressJS
app.get('/',function(req,res){
res.sendFile('index.html');
});
@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 / 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 / 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 / app.js
Created October 10, 2016 23:51
Callback example
var rect = require('./module');
function solveRect(l,b) {
console.log("Solving for rectangle with l = " + l + " and b = " + b);
rect(l,b, function(err,rectangle) {
if (err) {
console.log(err);
}
else {
console.log("The area of a rectangle of dimensions length = " + l + " and breadth = " + b + " is " + rectangle.area());
@Sysetup
Sysetup / currying.js
Created October 12, 2016 19:57
Currying in Functional JavaScript.
var greetCurried = function(greeting) {
return function(name) {
console.log(greeting + ", " + name);
};
};
var greetHello = greetCurried("Hello");
//console.log('greetHello: ' + greetHello());
greetHello("Heidi"); //"Hello, Heidi"
greetHello("Eddie"); //"Hello, Eddie"
@Sysetup
Sysetup / object.js
Created October 12, 2016 22:21
Object prototype (Object constructor function) basic example.
var txt = "";
var x;
function Person(first, last, age, sex) { //Object prototype (Object constructor function)
this.firstName = first;
this.lastName = last;
this.age = age;
this.sex = sex;
this.changeFirstName = function (name) {
this.firstName = name;
@Sysetup
Sysetup / index.html
Created October 12, 2016 23:10
try...catch statement. Example.
<!DOCTYPE html>
<html>
<body>
<p>Please input a number between 5 and 10:</p>
<input id="demo" type="text">
<button type="button" onclick="myFunction()">Test Input</button>
<p id="message"></p>
<script>