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
<% if @url.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@url.errors.count, "error") %> prohibited this url from being saved:</h2> | |
<ul> | |
<% @url.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> | |
</div> |
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> | |
<title>Node.js chat</title> | |
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" /> | |
<script type="text/javascript" src="jquery-1.7.2.js"></script> | |
<script type="text/javascript" src="/nowjs/now.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
now.receiveMessage = function(time, name, message) { |
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
JAXBContext jaxbContext = JAXBContext.newInstance(Profile.class); | |
Marshaller marshaller = jaxbContext.createMarshaller(); | |
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); | |
marshaller.marshal(profile, System.out); |
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
class ValidadorCPF | |
REGEX = /\A(\d{3}\.?){2}\d{3}\-?\d{2}\Z/ | |
def self.valido?(cpf) | |
return false unless REGEX =~ cpf | |
arr = cpf.scan(/\d/).take(9) | |
arr << calcular_dv(arr) |
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
package com.liferayinaction.portlet; | |
import java.io.IOException; | |
import javax.portlet.ActionRequest; | |
import javax.portlet.ActionResponse; | |
import javax.portlet.GenericPortlet; | |
import javax.portlet.PortletException; | |
import javax.portlet.PortletMode; | |
import javax.portlet.PortletPreferences; |
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
<?xml version="1.0" encoding="iso-8859-1" ?> | |
<sroxml> | |
<versao>1.0</versao> | |
<qtd>1</qtd> | |
<TipoPesquisa>Lista de Objetos</TipoPesquisa> | |
<TipoResultado>Todos os eventos</TipoResultado> | |
<objeto> | |
<numero>SW371675211BR</numero> | |
<evento> | |
<tipo>BDE</tipo> |
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
import java.io.DataInputStream; | |
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.PrintStream; | |
import java.net.URL; | |
import java.net.URLConnection; | |
public class CorreiosCarrierTracker { | |
public static void main(String[] args) { |
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
package com.walmart.customer.services.frontend.domain.test; | |
import java.sql.Connection; | |
import javax.sql.DataSource; | |
import org.dbunit.database.DatabaseConnection; | |
import org.dbunit.database.IDatabaseConnection; | |
import org.dbunit.dataset.IDataSet; | |
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder; |
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
package net.tardivo.prosoft.excel.reader; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.InputStream; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.regex.Pattern; | |
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
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
# Ruby version from https://github.com/derekhh/HackerRank/blob/master/mathematics/combinatorics/lexicographic-steps.cpp | |
# Build the 'Lower Pascal matrix' | |
# http://rosettacode.org/wiki/Pascal_matrix_generation#Ruby | |
ng = (g = 0..20).collect{ [] } | |
g.each { |i| g.each { |j| ng[i][j] = j == 0 ? 1 : i < j ? 0 : ng[i - 1][j - 1] + ng[i - 1][j] } } | |
# Uncomment the line bellow to print the matrix | |
# ng.each { |i| i.each { |j| print "#{j}\t" }; puts } | |
t = gets.chomp.to_i |
OlderNewer