Skip to content

Instantly share code, notes, and snippets.

@abuiles
abuiles / temp
Created November 19, 2009 05:19
/home/adolfo/.xmonad/xmonad-i386-linux: executeFile: does not exist (No such file or directory)
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 2 (X_ChangeWindowAttributes)
Serial number of failed request: 7
Current serial number in output stream: 8
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <GL/glut.h>
using namespace std;
int x1,x2,y1,y2 = 0;
void drawLine ( int x1 , int y1 , int x2 , int y2 )
// robot.c: Adaptado de OpenGL Programming Guide (Neider, Davis, Woo)
#include <GL/glut.h>
#include <stdio.h>
GLfloat angle, fAspect;
static int shouldery = 0, shoulder = 0, elbow = 0,wrist=0,finger1 = 0,finger2 = 0;
GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 };
@abuiles
abuiles / temp
Created November 26, 2009 04:06
data Post = Post { title :: String , author :: User , comments :: [Comments], votes :: Int }
data User = User { nickName :: String, email :: String } -- Any other relevant info ?
data Comments = Comment {author :: User, body :: String } -- " " " " ?
(defun google-region (beg end)
"Google the selected region."
(interactive "r")
(browse-url (concat "http://www.google.com/search?ie=utf-8&oe=utf-8&q=" (buffer-substring beg end))))
(defun translate-region (beg end)
"Show the translation of the selected word."
(interactive "r")
(browse-url (concat "http://www.wordreference.com/es/translation.asp?tranword=" (buffer-substring beg end))))
class BuildList r where
type Build r
build' :: [Build r] -> Build r -> r
instance BuildList [a] where
type Build [a] = a
build' l x = reverse $ x:l
instance BuildList r => BuildList (a-> r) where
type Build (a -> r) = Build r
;;Full screen
(defun toggle-fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen)
nil
'fullboth)))
(global-set-key [(meta return)] 'toggle-fullscreen)
(defun google-region (beg end)
"Google the selected region."
(interactive "r")
(browse-url (concat "http://www.google.com/search?ie=utf-8&oe=utf-8&q=" (buffer-substring beg end))))
(defun translate-region (beg end)
"Show the translation of the selected word."
(interactive "r")
(browse-url (concat "http://www.wordreference.com/es/translation.asp?tranword=" (buffer-substring beg end))))
;; hiding toolbar menubar scrollbar
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
Rails assumes that a join table is named after the two tables it joins (with the
names in alphabetical order). Rails will automatically find the join table cat-
egories_products linking categories and products. If you used some other name,
you’ll need to add a :foreign_key declaration so Rails can find it. We describe
this in Section 19.3, belongs_to and has_xxx Declarations, on page 362.
Note that our join table does not need an id column for a primary key, because
the combination of product and category id is unique. We stopped the migra-
tion from automatically adding the id column by specifying :id => false. We then
created two indices on the join table. The first, composite index actually serves