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> // for exit | |
#include <sys/socket.h> // for socket | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <sys/wait.h> |
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 <sys/socket.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <sys/wait.h> |
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 Class | |
def where | |
"in class Class" | |
end | |
end | |
person = Class.new | |
puts "person.where: #{person.where}" # => "in class Class" | |
class << person |
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 Test | |
class_eval <<-END | |
def self.a | |
puts "a" | |
end | |
END | |
instance_eval <<-END | |
def b | |
puts "b" |
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
<% items = [] %> | |
<% ["About", "FAQ", "Mission", "Blog", "Advertise"].each do |page| %> | |
<% items << %(<strong>#{link_to t(page.downcase.to_sym), '/page/#{page.downcase}', :class => :dark}</strong>) %> | |
<% end %> | |
<%=raw items.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
def v2ex_api(path) | |
url = URI.parse("http://v2ex.appspot.com") | |
res = Net::HTTP.start(url.host, url.port) do |http| | |
http.get(path) | |
end | |
ActiveSupport::JSON.decode res.body | |
end | |
puts v2ex_api("/api/members/show.json?username=daqing").inspect |
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
/** | |
* Basecamp stylesheet, based on "alternate" | |
* author: Peter Theill, Commanigy - http://commanigy.com | |
* | |
* @2009-11-16 - fix #3069 | |
* @2009-11-12 - styling "password" fields as well with a simple border (similar to other fields) | |
* | |
*/ | |
@import url(../../../stylesheets/application.css); |
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
#!/usr/bin/expect -f | |
array set d { | |
141 "abc" | |
142 "foobar" | |
145 "buz" | |
} | |
if { $argc != 1 } { | |
puts "usage: $argv0 HOST" | |
puts "HOST can be 195 or 201" |
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
" ========================= | |
" File: daqing.vim | |
" Description: small plugin to asistant my day-to-day development | |
" Maintainer: Kinch Zhang <[email protected]> | |
" License: The MIT License <http://www.opensource.org/licenses/mit-license.php> | |
" ========================= | |
fun! Write(str) | |
execute "normal I" . a:str . "\<Esc>" | |
endfun |
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
import scala.actors.Actor | |
import scala.actors.Actor._ | |
case object Ping | |
case object Pong | |
case object Stop | |
class Ping(count: Int, pong: Actor) extends Actor { | |
def act() { | |
var pingsLeft = count - 1 |