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
[1] (pry) main: 0> 1.class | |
=> Fixnum | |
[2] (pry) main: 0> 1.method(:+) | |
=> #<Method: Fixnum#+> | |
[3] (pry) main: 0> 1 + 0 == 0 + 1 | |
=> true | |
[4] (pry) main: 0> 2.0.class | |
=> Float | |
[5] (pry) main: 0> 2.0.method(:*) |
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
[1] (pry) main: 0> class AdditionMonoid | |
[1] (pry) main: 0* def identity | |
[1] (pry) main: 0* 0 | |
[1] (pry) main: 0* end | |
[1] (pry) main: 0* | |
[1] (pry) main: 0* def operation(a, b) | |
[1] (pry) main: 0* a + b | |
[1] (pry) main: 0* end | |
[1] (pry) main: 0* end | |
=> :operation |
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
cat ./1-219.1.txt | convert \ | |
-font Courier \ | |
text:- \ | |
-rotate `convert null: -format '%[fx:rand()*15-7]' info:` \ | |
-attenuate 0.1247 +noise Gaussian \ | |
-colorspace Gray \ | |
1-219.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
source :rubygems | |
# We are not loading Active Record, nor Active Resources etc. | |
# We can do this in any app by simply replacing the rails gem | |
# by the parts we want to use. | |
gem "actionpack", "~> 3.2" | |
gem "railties", "~> 3.2" | |
gem "tzinfo" | |
# Let's use thin |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Copyright (c) Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
; which can be found in the file CPL.TXT at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. | |
;dimensions of square world |
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
// 6,046 bytes jarred. | |
/* | |
Copyright 2012 Viktor Klang | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.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
<?php | |
function checkAno($AnoProd) | |
{ | |
$reg = '/([1-9])([0-9]*)/'; | |
return preg_match($reg, $AnoProd); | |
} | |
function checkEmail($Correo) | |
{ | |
$reg = '#^(((([a-z\d][\.\-\+_]?)*)[a-z0-9])+)\@(((([a-z\d][\.\-_]?){0,62})[a-z\d])+)\.([a-z\d]{2,6})$#i'; | |
return preg_match($reg, $Correo); |
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
require 'rubygems' | |
require 'benchmark' | |
require 'haml' | |
require 'erubis' | |
engine = Haml::Engine.new(File.read('template.haml')) | |
erb_template = File.read('template.erb') | |
Benchmark.bm do |x| | |
x.report('haml:') { 1000.times{ engine.render } } |
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: redis-cli publish message.achannel hello | |
require 'sinatra' | |
require 'redis' | |
conns = Hash.new {|h, k| h[k] = [] } | |
Thread.abort_on_exception = true | |
get '/' 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
public class Connection { | |
String URL = "http://iwarn-staging.herokuapp.com/"; | |
String result = ""; | |
String deviceId = "xxxxx" ; | |
final String tag = "Your Logcat tag: "; | |
public void callWebServiceForSendData(String jsonData){ | |
HttpClient httpclient = new DefaultHttpClient(); |
NewerOlder