Skip to content

Instantly share code, notes, and snippets.

View pablq's full-sized avatar
🐢
Chillin

Pablo Philipps pablq

🐢
Chillin
View GitHub Profile
/* wow */
factorial(0,1).
factorial(n,f) :-
n>0,
n1 is n-1,
factorial(n1,f1),
f is n * f1.
@pablq
pablq / notes7a.scm
Last active November 20, 2015 05:00
notes from lecture 7a of Structure and Interpretation of Computer Programs
;; purely for effect --- this is not a practical implementation
(define eval
(lambda (expression environment)
(cond ((number? expression) expression)
((symbol? expression) (lookup expression environment))
((eq? (car expression) 'quote) (cadr expression))
((eq? (car expression) 'lambda)
(list 'closure (cdr expression) environment))
((eq? (car expression) 'cond)
(evcond (cdr expression) environment))
Congrats, class.
You all have killed it. It might not all be mega clear yet, but by now you have all made some seriously pro level websites:
1) The front-end is responsive.
2) The back-end is RESTFUL.
3) The front-end and back-end are actually two independent websites that work together!!!
Front-end:
There are many different ways to structure front-end code for websites
In this class, we used Foundation to help us set up our layout.
@pablq
pablq / Promise.js
Created June 22, 2015 03:11
practice promise implementation (from http://dailyjs.com/2014/02/20/promises-in-detail/)
module.exports = function(fn) {
var state = "pending";
var value;
var deferred = null;
function resolve(newValue) {
try {
// checks if a newValue is a promise
if (newValue && typeof newValue.then === "function") {
@pablq
pablq / pointer_practice.c
Created January 15, 2015 05:06
just brushing up a bit. haven't looked at C code in a while.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INT_MAX 1000
#define UINT_MAX 10
char* getString(void);
int getInt(void);
int* getAge(void);
@pablq
pablq / vimnotes
Created June 26, 2014 02:40
notes to get better at vim
NO MORE ARROW KEYS
hold j, hold k, hold l, hold h.
enough for today.

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

// wow this one killed me for a bit. now i should mention i have very little to no javascript experience...
// i got it though!
// getting the thing to not put a comma after the last element was the hardest part!
function solution(pairs)
{
var size = 0, checksize = 1, s = "", key;
for (key in pairs)
{
if (pairs.hasOwnProperty(key))
public class JustForFun
{
public static void main(String[] args)
{
System.out.println("Hello, Github!");
}
}
@pablq
pablq / check function for pset6
Last active August 29, 2015 13:57
help me improve this function please! i don't know what's slowing it down soo much!
// NOTE: I HAVE FOUND A SOLUTION!
// I SOLVED MY CHECK FUNCTION WOES IN THREE WAYS:
// FIRST, I EXPANDED THE SIZE OF MY HASH TABLE BY A LOT ... TSIZE WAS 600 ... NOW IT IS 65557
// SECOND, I ADJUSTED MY HASH FUNCTION TO DISPERSE ITEMS MORE EVENLY ACROSS ALL INDEXES OF THE TABLE -- and here-in discovered
// the true problem with the code below ---> the hash function is almost completely useless. the while loop's exiting condition
// is met (i != '\0') right away because i is initialized to 0. what i meant it to do was run while input[i] != '\0'. however,
// that syntax in the condition didn't work, so i changed the function to accept the string length as another variable.
// THIRD, WITH THE HELP OF EBOBTRON I ELIMINATED CALLS OF ISUPPER() AND TOLOWER() WHILE MAINTAINING CASE-INSENSITIVITY.
// Finally, THANK YOU to ebobtron, escarre, and dermot for helping me solve this one!
// It has really been fun and difficult! It's always a dumb minor syntax error that holds ya up huh?! Boy i was puzzled for