This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`frag.glsl` | |
uniform sampler2D tex_normal; | |
`.cpp` | |
glUniform1i(glGetUniformLocation(pid, "tex_normal"), 1); | |
auto c = glGetUniformLocation(pid, "tex_normal"); | |
// c = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gcc -Wall main.c -o a -framework OpenGL -framework GLUT | |
/* Copyright (c) Mark J. Kilgard, 1994. */ | |
/* This program is freely distributable without licensing fees | |
and is provided without guarantee or warrantee expressed or | |
implied. This program is -not- in the public domain. */ | |
/* blender renders two spinning icosahedrons (red and green). | |
The blending factors for the two icosahedrons vary sinusoidally | |
and slightly out of phase. blender also renders two lines of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -g main.c -o a -lpthread | |
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef pthread_mutex_t mutex_t; | |
typedef struct { | |
int* ary; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn for-each-pixel [constant max-itrs radius r-min x-step y-step px] | |
(let [[j i] px | |
[x y] (normalize-coords (double j) (double i) r-min x-step y-step) | |
z (->Complex x y) | |
zitrs (sq-poly-iteration z constant max-itrs radius) | |
idx (dec (count zitrs))] | |
(when (> idx @impure/max-idx) | |
(reset! impure/max-idx idx)) | |
[j i idx])) | |
;(bench (julia/for-each-pixel (->Complex rc ic) max-itrs radius r-min x-step y-step [xt yt]))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(.select js/d3 "#random-mean") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.2.1 :001 > str = "asdfasdf" | |
=> "asdfasdf" | |
2.2.1 :002 > def foo(x) | |
2.2.1 :003?> x = "john" | |
2.2.1 :004?> end | |
=> :foo | |
2.2.1 :005 > foo(str) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn insert-page-into-db [page] | |
(println page) ; <-- doesn't get run | |
(try | |
(sql/insert! db-conn-vars :pages | |
[:title, :pageid] | |
[(get page "title"), (Integer. (get page "pageid"))]) (catch Exception e (println e)))) | |
(defn insert-pages-into-db [pages] | |
(println pages) ; <-- gets ran | |
(map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'rails/test_help' | |
class ActiveSupport::TestCase | |
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | |
fixtures :all | |
include FactoryGirl::Syntax::Methods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { worker_connections 1024; } | |
http { | |
#include /etc/nginx/conf.d/*.conf; | |
upstream roundrobin { | |
server localhost:8080; | |
server localhost:80; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { worker_connections 1024; } | |
http { | |
upstream roundrobin { | |
# roundrobin is enabled by default | |
server google.com; | |
server msn.com; | |
server yahoo.com; | |
} |