Skip to content

Instantly share code, notes, and snippets.

View carlosdiaz's full-sized avatar
🏠
Working from home

Carlos carlosdiaz

🏠
Working from home
  • San Diego California
View GitHub Profile
@carlosdiaz
carlosdiaz / schema.graphql
Last active March 17, 2021 21:40
TODOS GraphQL file
# we use a enum to define the possible values for categorizing the Priority for a TODO task
enum Priority {
HIGH
MEDIUM
LOW
}
# we define the Todos data structure, and we use the previous Priority definition
type Todos {
id: String!
{
"name": "portal_axios_sample_submission",
"version": "0.1.0",
"private": true,
"engines": {
"node": "10.16.x",
"npm": "6.x"
},
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
import sqlite3
import cherrypy
import json
class ExposeRealStateDB(object):
app = '/tmp/propertyRS.db'
@cherrypy.expose
def getproperty(self, id):
public class PrimeNumbersList{
public static void main(String args[]) {
System.out.println("Starting...");
List<Integer> list = computePrimes(20);
for(Integer object: list) {
System.out.println(object);
@carlosdiaz
carlosdiaz / NumberJson.py
Created October 1, 2015 02:43
Based on json representation http://www.json.org/number
import re
str = '-1.95'
#str = '0.3456'
#str = '1.341516'
#str = '0.89788'
#yes, large regular expression but seems it solves, tested with different scenarios
pattern = re.compile(r'''^((-\d*)(.\d*)|(0.\d*)|((0.\d*(e|E)(\+|\-)\d))|((-\d*)(.\d*))(((e|E)(\+|\-)\d)))$''', re.VERBOSE)
print pattern.match(str)
@carlosdiaz
carlosdiaz / Fizbuzz.scala
Created September 30, 2015 22:37
FizzBuzz in scala
//FizzBuzz in scala
object FizzBuzz{
def main(args: Array[String]){
for (i <- 0 until 100){
if (i % 3 == 0){
if(i % 5 == 0){
println(i + " is FizzBuzz")
}
else
{
var Hello = React.createClass({
getInitialState : function(){
return { dato1 : 'Marcos', dato2 : 1234};
},
render: function() {
setTimeout(function(){ this.setState( { dato1 : 'Carlos'}); }.bind(this),5000);
return <div>Hello {this.state.dato1}</div>;
#!/usr/bin/env python
def FizzBuzz():
i=0
while (i<101):
print i
if i % 15 == 0:
print "FizzBuzz"
elif i % 3 == 0:
print "Fizz"
@carlosdiaz
carlosdiaz / FiboRec.py
Created June 16, 2015 16:04
Fibonacci recursive python
#!/usr/bin/env python
def FiboRecu( numero):
if (numero==1 or numero ==2):
return 1
else:
return FiboRecu(numero-1)+FiboRecu(numero-2)
if __name__=='__main__':
@carlosdiaz
carlosdiaz / FactorialRec.py
Created June 16, 2015 15:36
Factorial in python
#!/usr/bin/env python
def FactorialRecu(numero):
if (numero==0 or numero ==1):
return 1
else:
return numero*FactorialRecu(numero-1)
if __name__=='__main__':