This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pdfminer.pdfparser import PDFParser | |
from pdfminer.pdfdocument import PDFDocument | |
from pdfminer.pdfpage import PDFPage | |
from pdfminer.pdfpage import PDFTextExtractionNotAllowed | |
from pdfminer.pdfinterp import PDFResourceManager | |
from pdfminer.pdfinterp import PDFPageInterpreter | |
from pdfminer.pdfdevice import PDFDevice | |
from pdfminer.layout import LAParams | |
from pdfminer.converter import PDFPageAggregator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
from bs4 import BeautifulSoup as bs | |
import re | |
import requests | |
rootPath = "http://www.cndc.org.ni/consultas/reportesDiarios/" | |
today = '03/02/2018' | |
def get_day_data(day): | |
content = requests.post(rootPath+"postDespacho/consultaResumen.php?fecha="+day) | |
table = bs(content.text, 'html.parser') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function permutations(s, cb){ | |
let n = s.length; | |
function swap(i, j){ | |
let tmp = s[i]; | |
s[i] = s[j]; | |
s[j] = tmp; | |
} | |
let c = []; | |
for(let i = 0; i < n; i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function permutations(s, cb){ | |
let n = s.length; | |
function swap(i, j){ | |
let tmp = s[i]; | |
s[i] = s[j]; | |
s[j] = tmp; | |
} | |
function heapGenerate(n){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function permutation(a){ | |
let res = []; | |
for(let i=0; i<a.length; i++){ | |
let restA = a.slice(0,i).concat(a.slice(i+1)); | |
let rest = permutation( restA); | |
if(rest.length === 0){ | |
res.push([a[i]]); | |
}else{ | |
for(let j=0; j<rest.length; j++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function solution(A){ | |
console.log(A); | |
var swaps = []; | |
function checkRight(index){ | |
let right = true, i=index + 1; | |
while(right && i < A.length){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var co = require('co'); | |
var contentful = require('contentful-management'); | |
var cc = contentful.createClient({ | |
accessToken: process.env.CONTENTFUL_MANAGEMENT_TOKEN | |
}); | |
var getEntriesGenerator = function* (space, type){ | |
let allItems = []; | |
let skip = 0; | |
let total = 1; | |
while(skip < total){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Flat array | |
#input = [[1,2,[3]],4, 5, [6,7]] | |
# How to use it: | |
# 1. ruby flat.rb | |
# 2. Type the input e.g: [[1,2,[3]],4, 5, [6,7]] | |
# 3. Type Enter and Ctrl-D | |
# it will print the oputput | |
def flat_array (input_a) | |
flatten = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addPreference: function(preference){ | |
var that = this; | |
return Question.findOne(preference.questionId) | |
.populate('configurator') | |
.then(function(question){ | |
return Preference.create({ | |
configurator: question.configurator.id, | |
question: question.id, | |
selectedAnswer: preference.selectedAnswer, | |
household: that.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
INPUT_SIZE = 50 | |
MAX_VAL = 100 | |
input = Array.new(INPUT_SIZE) | |
$num_comparisons = 0; | |
#Intializing the input | |
for i in 0..INPUT_SIZE - 1 |
NewerOlder