This file contains 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/sh | |
uplatex $1 && dvipdfmx -f cid-x.map $1 && open -a Preview "$1.pdf" |
This file contains 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
p =->(x){x**2} | |
#call with p.call(x) or p.(x) |
This file contains 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
#define 1377 classes with different names and each has one class method with different names and one instance methtod with different names | |
def leet_classes | |
(1..1337).to_a.map do |i| | |
Object.const_set("FooBar_#{i}", Class.new { | |
define_singleton_method("class_method_#{i}") { "class_method_value_#{i}" } | |
define_method("instance_method_#{i}") { "instance_method_value_#{i}" } | |
}) | |
end | |
end |
This file contains 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
//Array#shuffle | |
Array.prototype.shuffle = function() { | |
var i = this.length; | |
while(i){ | |
var j = Math.floor(Math.random()*i); | |
var t = this[--i]; | |
this[i] = this[j]; | |
this[j] = t; | |
} | |
return this; |
This file contains 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
/**************************************************************************** | |
* | |
* NLPIR/ICTCLAS Lexical Analysis System Copyright (c) 2000-2014 | |
* Dr. Kevin Zhang (Hua-Ping Zhang) | |
* All rights reserved. | |
* | |
* This file is the confidential and proprietary property of | |
* Kevin Zhang and the possession or use of this file requires | |
* a written license from the author. | |
* Filename: |
This file contains 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
<!-- | |
light box with rails4 | |
!--> | |
<%= link_to image_tag(image.thumb), image.url, :'data-lightbox' => image.id %> |
This file contains 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
#model | |
class Band | |
include Mongoid::Document | |
has_and_belongs_to_many :tags | |
end | |
class Tag | |
include Mongoid::Document | |
field :name, type: String | |
has_and_belongs_to_many :bands |
This file contains 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
# usage: | |
# ruby parse_torrent.rb keyword page_numbers | |
require "mechanize" | |
agent=Mechanize.new | |
term=ARGV[0] | |
offset=0 | |
offset=ARGV[1].to_i if ARGV[1]!=nil | |
torrent_links=[] | |
for i in 0..offset |
This file contains 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/env ruby | |
# A quick and dirty implementation of an HTTP proxy server in Ruby | |
# because I did not want to install anything. | |
# | |
# Copyright (C) 2009-2014 Torsten Becker <torsten.becker@gmail.com> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# "Software"), to deal in the Software without restriction, including | |
# without limitation the rights to use, copy, modify, merge, publish, |
OlderNewer