Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Carlos carlosdiaz

🏠
Working from home
  • San Diego California
View GitHub Profile
@carlosdiaz
carlosdiaz / schema.graphql
Last active Mar 17, 2021
TODOS GraphQL file
View schema.graphql
# 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!
View package.json
{
"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",
View cherry_flaskalchemy.py
import sqlite3
import cherrypy
import json
class ExposeRealStateDB(object):
app = '/tmp/propertyRS.db'
@cherrypy.expose
def getproperty(self, id):
View PrimeNumbersList.java
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);
View NumberJson.py
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)
View Fizbuzz.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
{
View ExamplesReactJS.js
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>;
View FizzBuzz.py
#!/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 Jun 16, 2015
Fibonacci recursive python
View FiboRec.py
#!/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 Jun 16, 2015
Factorial in python
View FactorialRec.py
#!/usr/bin/env python
def FactorialRecu(numero):
if (numero==0 or numero ==1):
return 1
else:
return numero*FactorialRecu(numero-1)
if __name__=='__main__':