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 (1...3999).map{|i|l="";"M1000DM900D500CD400C100XC90L50XL40X10IX9V5IV4I1".scan(/(\D+)(\d+)/).inject(i){|a,(n,k)|k=k.to_i;while(a>=k);a-=k;l<<n;end;a};l} |
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"#{$*}".scan(/./).reverse.inject([0,0]){|(a,b),m|[a+((m=10**((l=("IVXLCDM"=~/#{m}/))/2)*(5**(l%2)))<b ?m*=-1:m),m]}[0] |
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
<html> | |
<head> | |
<title>We love shadows! A dynamic light source example created with JavaScript and CSS3</title> | |
<meta name="description" content="An example created by Sandro Paganotti trying to reproduce a light source effect using Javascript and CSS3" /> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> | |
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'> | |
<link href='http://fonts.googleapis.com/css?family=Josefin+Sans+Std+Light' rel='stylesheet' type='text/css'> | |
<style> | |
body{ | |
background: #575757; |
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
#= part 1 | |
reg = | |
/^ | |
[\w!#\$%&'*+\/=?`{|}~^-]+ # 1 or more glyph of: underscore alphabetic letters and symbols choosed from !#\$%&'*+\/=?`{|}~^- | |
# followed by | |
(?:\. # a non-catching block wich has to begin with a dot followed by | |
[\w!#\$%&'*+\/=?`{|}~^-]+ # 1 or more gliyp of the same class of line 3. | |
)* # this block can apper 0 or more times. | |
@ # followed by an 'at' sign |
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
# O(n) Tombolizer | |
class Extractor | |
def initialize(range) | |
@range, @list = range, {} | |
end | |
def extract | |
time = Time.now.to_i | |
Array.new(@range).each_with_index.map {|e,i| | |
token = @list[rnd = (time % (@range - i)) + 1] || rnd | |
@list[rnd] = @list[@range - i] || @range - i |
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
<!DOCTYPE web-app PUBLIC | |
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" | |
"http://java.sun.com/dtd/web-app_2_3.dtd"> | |
<web-app> | |
<context-param> | |
<param-name>public.root</param-name> | |
<param-value>/</param-value> | |
</context-param> |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset='utf-8'> | |
<title>Edit - Il Blog di HTML.it</title> | |
<!--[if lt IE 9]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<link rel="stylesheet" href="css/default.css" type="text/css"> | |
<![endif]--> | |
<link rel="stylesheet" href="http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css" type="text/css"> |
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
# more info and usage here: | |
# http://sandropaganotti.com/2012/10/28/migrating-a-single-site-of-a-wordpress-multisite-instance/ | |
require 'yaml' | |
require 'ostruct' | |
require 'mysql2' | |
require 'php_serialize' | |
namespace :util do | |
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
/* | |
To use it: | |
require(['video'], function(Video){ | |
var video = new Video('.video'); | |
// optionally, you can either drag a video file over the .video element | |
video.playvideo('a valid video url'); | |
}); | |
*/ |
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
<?php | |
/* -- suppose you want to add a new colorpicker field type -- */ | |
add_action( 'init', 'boot_colorpicker' ); | |
/* -- first we create a file in the 'fields' directory of the plugin to notify Types of this new type -- */ | |
function boot_colorpicker(){ | |
$colorpicker_path = WPCF_EMBEDDED_INC_ABSPATH . '/fields/colorpicker.php'; | |
if( !file_exists($colorpicker_path) ){ | |
file_put_contents($colorpicker_path, "<?php // automatically generated \n ?>"); |
OlderNewer