Skip to content

Instantly share code, notes, and snippets.

View calvimor's full-sized avatar

Carlos Alberto Villamizar Morantes calvimor

View GitHub Profile
function myFunc() {
var x = 0;
for (var i = 0; i < arguments.length; i++) {
x = x + arguments[i];
}
return x;
}
// Code goes here
var Calc = function (start) {
var that = this;
this.add = function(x) {
start = start + x;
return that;
};
this.multiply = function (x) {
var Book = function (name, price) {
var priceChanging = [],
priceChanged = [];
this.name = function (val) {
return name;
};
this.price = function (val) {
if(val !== undefined && val !== price) {
for (var i = 0; i < priceChanging.length; i++) {
@calvimor
calvimor / config-git.md
Last active October 5, 2016 15:15
Configuring git

Configuring Git

Global

git config --global user.name calvimor
git config --global user.email [email protected]

git config --global core.editor vim|atom

git config --global core.autocrlf true|false|input
@calvimor
calvimor / git-commands.md
Last active September 11, 2023 01:12
Common Git Commands

Git Commands

Initialize git repo

First of all you have to initialize the repository with git init. You can run this command on an empty directory or not.

Once you have initialized the repo, there is a workflow in git that you should do every time you make changes like add/delete/update files.

git status
git add -A
git commit -m "a little description"
<html>
<head>
<title>API Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var accessToken = "<your agent's client access token>";
var baseUrl = "https://api.api.ai/v1/";
$(document).ready(function() {
$("#input").keypress(function(event) {
@calvimor
calvimor / package.json
Created January 18, 2017 15:36
package.json for Building a JS Development Environment
{
"name": "js-dev-environment",
"version": "1.0.0",
"description": "JavaScript development environment",
"scripts": {
},
"author": "Carlos Villamizar",
"license": "MIT",
"dependencies": {
"whatwg-fetch": "1.0.0"
@calvimor
calvimor / webpack.config.dev.js
Created January 19, 2017 18:10
Development Webpack config for "Building a JavaScript Development Environment"
import path from 'path';
export default {
debug: true,
devtool: 'inline-source-map',
noInfo: false,
entry: [
path.resolve(__dirname, 'src/index')
],
target: 'web',
@calvimor
calvimor / .eslintrc.json
Created January 23, 2017 14:58
.eslintrc.json file for "Building a JavaScript Development"
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
@calvimor
calvimor / mockDataSchema.js
Created January 27, 2017 15:53
Mock Data Schema for "Building a JavaScript Development Environment"
export const schema = {
"type": "object",
"properties": {
"users": {
"type": "array",
"minItems": 3,
"maxItems": 5,
"items": {
"type": "object",
"properties": {