Skip to content

Instantly share code, notes, and snippets.

View danielSanchezQ's full-sized avatar
🦀

Daniel Sanchez danielSanchezQ

🦀
View GitHub Profile
class Python (QSyntaxHighlighter):
"""Syntax highlighter for the Python language.
"""
# Python keywords
keywords = [
'and', 'as', 'assert', 'break', 'class',
'continue', 'def', 'del', 'elif', 'else',
'except', 'exec', 'finally', 'for', 'from',
'global', 'if', 'import', 'in', 'is',
'lambda', 'not', 'or', 'pass', 'print', 'raise',
@danielSanchezQ
danielSanchezQ / main.scm
Created April 18, 2012 12:17
main loop cleaned
;; Copyright (c) 2012, Alvaro Castro-Castilla. All rights reserved.
;; Game by: Daniel Sanchez, Alejandro Cabeza, Carlos Belmonte and Juan Maria Vergara
(pg:app
setup: (lambda (resources)
(make-environment 600 400 resources #f))
main-loop:
@danielSanchezQ
danielSanchezQ / puzzle.cpp
Created July 30, 2012 00:23
Backtrack puzzle solve algorith
#include <fstream>
#include "puzzle.h"
using namespace std;
Puzzle_game::Puzzle_game()
{
Solve = false;
for(int i = 0; i < 4; i++)
@danielSanchezQ
danielSanchezQ / StringTransformers.cpp
Created May 10, 2016 13:44
how to wrapp string numeric conversion methods, c++11
#include <iostream>
#include <functional>
#include <string>
template<class T>
T getFromString(const std::string& value, std::function<T(const std::string&)> f)
{
return f(value);
}
@danielSanchezQ
danielSanchezQ / StringTransformersSStream.cpp
Created May 12, 2016 12:46
String stream version of string transformers
#include <iostream>
#include <functional>
#include <string>
template<class T>
T getFromString(const std::string& value, std::function<T(const std::string&)> f)
{
return f(value);
}
@danielSanchezQ
danielSanchezQ / Generators cool stuff
Last active July 26, 2016 10:35
Python generators cool stuff
from itertools import *
from operator import *
def fibogen():
a,b = 1,1
yield a
yield b
while True:
res = a+b
a, b = b, res
yield res
@danielSanchezQ
danielSanchezQ / BrainFuck.hs
Created September 15, 2017 07:59
Brainfuck interpreter in haskell
import System.Environment
import Data.Char
type Cells = [Int]
type Ptr = Int
type OutBuffer = String
type Stack = (Ptr, Cells, OutBuffer)
defValue :: Int
defValue = 0
// bInarytree.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <algorithm>
class BinaryTree
{
private:
@danielSanchezQ
danielSanchezQ / VietNumbers.py
Created December 21, 2017 09:25
Number to vietnamese representation
from itertools import *
vietNums = {
0 : u"",
1 : u"một",
2 : u"hai",
3 : u"ba",
4 : u"bốn",
5 : u"năm",
6 : u"sáu",
@danielSanchezQ
danielSanchezQ / matrix_transform_playground.py
Last active January 15, 2018 16:33
Short code to apply matrix transfomation over a cube in maya
import maya.cmds as cmds
import itertools as it
def transpose(m, size=4):
return list(it.chain.from_iterable(map(
lambda x: m[x:len(m):size],
xrange(size)
)))
class TransformationsPlayground(object):