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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdbool.h> | |
| bool rightTriangle(int a, int b, int c) { | |
| return a*a == b*b + c*c; | |
| } | |
| void printTriangle(int a, int b, int c, bool printed) { | |
| printf("%s[(%i),(%i),(%i)]", (printed ? "," : ""), a, b, c); |
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
| puts (1..500).inject([]) {|acc,a| | |
| (1..a).inject(acc) {|acc,b| | |
| (1..b).inject(acc) {|acc,c| | |
| acc << [a, b, c] if (a**2) == (b**2) + (c**2) | |
| acc | |
| } | |
| } | |
| }.map {|triangle| triangle.inspect }.join(',') |
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
| module Enumerable | |
| def sift! &block | |
| ret, keep = partition {|i| | |
| yield i | |
| } | |
| self.replace keep | |
| ret | |
| end | |
| end | |
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
| #!/bin/bash | |
| iptables="iptables" | |
| # network settings | |
| iface_main="eth0" | |
| iface_vhosts="eth0:0" | |
| ip_main=`ifconfig $iface_main | grep "inet addr" | cut -d: -f2 | cut -d" " -f1` | |
| ip_vhosts=`ifconfig $iface_vhosts | grep "inet addr" | cut -d: -f2 | cut -d" " -f1` | |
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
| require 'rubygems' | |
| require 'hpricot' | |
| class Requester | |
| def initialize | |
| `touch cookies` | |
| login | |
| end | |
| def login |
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
| class Integer | |
| def to_ord | |
| self.to_s + ((10...20) === self ? 'th' : %w{th st nd rd th th th th th th}[int % 10]) | |
| end | |
| end |
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
| rightTriangles :: [(Int, Int, Int)] | |
| rightTriangles = [ (a,b,c) | c <- [1..100], b <- [1..c], a <- [1..b], a*a + b*b == c*c] | |
| main = print rightTriangles |
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
| /* GHC_PACKAGES base rts | |
| */ | |
| #include "Stg.h" | |
| #include "HsBase.h" | |
| EI_(base_GHCziShow_zdf17_closure); | |
| EI_(base_GHCziShow_zdf13_closure); | |
| static StgWord rtZ_srt[] = { | |
| (W_)&base_GHCziShow_zdf17_closure, (W_)&base_GHCziShow_zdf13_closure | |
| }; | |
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
| var handle_list_link = function() { | |
| // Get the currently displayed element in the list, if there is one | |
| var cur = $(this).parents('ul.list:first').children('li.cur'); | |
| var cur_clicked = $(this).is('.cur'); | |
| // If there is a current element, hide it | |
| if (cur.length != 0) { | |
| cur.removeClass('cur') | |
| .children('a.cur').removeClass('cur') | |
| .siblings('.data:visible').hide('drop', {direction: 'down'}); |
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
| $(function() { | |
| // Load JS-dependent CSS | |
| $(document.createElement('link')) | |
| .attr({type: 'text/css', href: '/stylesheets/js.css', rel: 'stylesheet', media: 'screen'}) | |
| .appendTo($('head')); | |
| }); |