Skip to content

Instantly share code, notes, and snippets.

View agarie's full-sized avatar

Carlos Agarie agarie

View GitHub Profile
@agarie
agarie / ajax-other-domains.js
Created April 28, 2012 05:32
Sending AJAX requests to other domains
/*
Used when you need a JSON feed from your other domain. Need a
Content-type of application/json, so be sure to use the correct
HTTP header in your app (at the other domain).
*/
// blabla just don't forget jQuery
$.ajax({
url: "another domain generating a JSON",
@agarie
agarie / natures
Created May 3, 2012 13:29
All the natures from the Pokémon series, with the corresponding increasing/decreasing stats names.
{
hardy: {
increase: "none",
decrease: "none"
},
docile: {
increase: "none",
decrease: "none"
},
serious: {
@agarie
agarie / index.html
Created May 6, 2012 03:55
CSS buttons for pokémon types.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Pok&eacute;mon Buttons for each type</title>
<link rel="stylesheet" type="text/css" href="./types.css" />
</head>
<body>
<div class='container'>
<span class="type normal left">normal</span>
@agarie
agarie / type-chart.json
Last active March 20, 2023 00:27
Pokémon type chart as a JSON.
{
"normal": {
"normal": 1,
"fire": 1,
"water": 1,
"electric": 1,
"grass": 1,
"ice": 1,
"fighting": 1,
"poison": 1,
@agarie
agarie / posts-list.html
Created August 3, 2012 04:44
Creating a list of posts separated by year and month with liquid templating
<ul class="post-list unstyled">
{% for post in site.posts %}
{% capture post_year %}
{{ post.date | date: "%Y" }}
{% endcapture %}
{% unless year == post_year %}
{% assign year = post_year %}
<h1>{{ year }}</h1>
@agarie
agarie / pi.adb
Created September 10, 2012 08:02
Estimating PI through simple geometry and statistics
with Ada.Text_IO;
with Ada.Float_Text_IO;
with Ada.Numerics.Float_Random;
use Ada.Text_IO;
use Ada.Float_Text_IO;
use Ada.Numerics.Float_Random;
procedure Pi is
N: constant Integer := 500000; -- Number of iterations.
@agarie
agarie / first.rb
Created September 29, 2012 05:24
Example of `yield self`
class Pokemon
def battle
yield self
end
end
mewtwo = Pokemon.new
mewtwo.battle do |m2|
puts m2
@agarie
agarie / quotes_generator.rb
Last active July 1, 2022 15:12
A jekyll plugin to generate a quotes index page from a quotes.json file.
#------------------------------------------------------------------------------
# QuotesGenerator
# A Jekyll plugin to generate a quotes/index.html page based on a Tumblr's
# account.
#
# You need a quotes.json file inside a SITE_ROOT/_data/ directory to use this
# plugin. It must use the same format as Tumblr's API v2.
#
# Available _config.yml settings:
# - text_size_limit: Maximum size of a used quote. Default to 1000.
@agarie
agarie / create_input.rb
Created October 5, 2012 01:44
A basic input creation script and some random inputs generated by it.
#!/usr/bin/env ruby
#
# This script creates checkerboard inputs for CS325 Program #4.
#
# Carlos Agarie
#
prng = Random.new
# Arbitrarily decided that 80% are checkers and 20% are kings.
@agarie
agarie / compiling
Created October 7, 2012 11:31
Installing ATLAS & LAPACK for NMatrix
$ rake compile
rake/gempackagetask is deprecated. Use rubygems/package_task instead
mkdir -p tmp/x86_64-darwin11.4.0/nmatrix/1.9.3
cd tmp/x86_64-darwin11.4.0/nmatrix/1.9.3
/Users/carlosagarie/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -I. ../../../../ext/nmatrix/extconf.rb
checking for clapack_dgetrf() in -llapack... no
checking for clapack.h... no
checking for cblas_dgemm() in -lcblas... yes
checking for ATL_dgemmNN() in -latlas... yes
checking for cblas.h... no