Skip to content

Instantly share code, notes, and snippets.

View GianCastle's full-sized avatar
🎯
Focus

Giancarlos Castillo GianCastle

🎯
Focus
View GitHub Profile
@GianCastle
GianCastle / README.md
Created March 3, 2020 10:06 — forked from sact1909/README.md
SQL Server Store Procedure to Fill Table with a Web API

SQL Server

This script was made by Steven Checo

How it works

  • You need to run the following code once, before create the stored procedure
sp_configure 'show advanced options', 1;   
GO   
RECONFIGURE; 
@GianCastle
GianCastle / useDidMount.js
Last active October 28, 2019 19:17
useDidmount.js
import React, { useLayoutEffect } from 'react'
const useDidMount = (f) => {
const [mounted, setState] = useState(false)
useLayoutEffect(() => {
setState((!mounted) ? true : false)
f()
})
@GianCastle
GianCastle / recursion.js
Created October 2, 2017 19:37 — forked from bendc/recursion.js
Functional loop
const loop = (() => {
const recur = (callback, count, i=0) => {
if (i == count-1) return callback(i);
callback(i);
return recur(callback, count, i+1);
};
return (callback, count) => {
if (count > 0) return recur(callback, count);
};
})();
/*jshint esversion: 6*/
const tabula = require('tabula-js');
const path = require('path');
const fs = require('fs');
let location = path.join(__dirname, '/test.pdf');
let resultFile = path.join(__dirname, '/output.csv');
let cmd = tabula(location,{area: "146.52,36.135,549.45,755.865", pages: "2"})
.extractCsv((err, data) => {
let output = [];
@GianCastle
GianCastle / Algorithm.js
Created October 10, 2015 19:36
Some sorting algorithms that i made in Javascript. One day i will need it. I will continue to add more sorting methods
//Sorting algorithms if i need it one day
function SortWith() {};
//Sorting Algorithm: The Cocktail Shaker Sort
// Complexity: O(n^2)
SortWith.cocktail = function (arr) {
for (var i = 0; i < arr.length / 2; ++i) {
var swap = false;
for (var j = i; j < arr.length - i - 1; ++j) {