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 Stack { | |
private Object[] elements; | |
private int size = 0; | |
private static final int DEFAULT_INITIAL_CAPACITY = 16; | |
public Stack() { | |
elements = new Object[DEFAULT_INITIAL_CAPACITY]; | |
} | |
public void push(Object e) { |
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 Context SetMailTemplate(string template, string mailCategory) | |
{ | |
IConfigurationSource configSource = ConfigurationSourceFactory.Create(); | |
var logSettings = configSource.GetSection(LoggingSettings.SectionName) as LoggingSettings; | |
if (logSettings == null) return this; | |
var categorySource = logSettings.TraceSources.SingleOrDefault(t => t.Name.Equals(mailCategory)); | |
if (categorySource == null) return this; | |
var emailListener = (from tRef in categorySource.TraceListeners |
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
namespace Cart.UnitTests | |
{ | |
[TestFixture] | |
public class MyTest | |
{ | |
[Test] | |
public void test_that_1_should_be_equal_to_2_or_sticazzi() | |
{ | |
Assert.That(1, Is.EqualTo(2).OrStiCazzi()); |
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
defun factorial(n) | |
if = n 1 | |
1 | |
n factorial(- n 1) |
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 static Rational operator +(Rational i, Rational j) | |
{ | |
return new Rational(i.numerator * j.denominator + i.denominator * j.numerator, i.denominator + j.denominator); | |
} |
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
iù semplice | |
public class Stack { | |
private Object[] elements; | |
private int size = 0; | |
private static final int DEFAULT_INITIAL_CAPACITY = 16; | |
public Stack() { | |
elements = new Object[DEFAULT_INITIAL_CAPACITY]; | |
} | |
public void push(Object e) { |
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
echo "A Volume not surviving the last container using it" | |
docker run -t -i --rm --name=foo -v /var/barbaz ubuntu:14.10 touch /var/barbaz/i-will-die | |
docker run -t -i --rm --name=foo -v /var/barbaz ubuntu:14.10 ls -l /var/barbaz/ | |
echo "Volume content survives the last container using it" | |
mkdir localdirectory | |
docker run -t -i --rm --name=foo -v $PWD/localdirectory:/var/barbaz ubuntu:14.10 touch /var/barbaz/i-will-not-die | |
rm -fr localdirectory | |
mkdir localdirectory | |
docker run -t -i --rm --name=foo -v $PWD/localdirectory:/var/barbaz ubuntu:14.10 ls -l /var/barbaz/ |
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
object Sample { | |
def parts(numbers: Vector[Any]): (Vector[Any], Vector[Any]) = | |
numbers.splitAt(numbers.length / 2) | |
def buildTree(numbers: Vector[Any]): Vector[Any] = | |
numbers.length match { | |
case 1 => numbers | |
case _ => Vector(buildTree(parts(numbers)._1), buildTree(parts(numbers)._2)) | |
} |
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
foo_result = shell('/usr/bin/foo', ignore_errors = True) | |
if foo_result == 5: | |
shell('/usr/bin/bar') | |
;; With Ansible DSL | |
tasks: | |
- shell: /usr/bin/foo | |
register: foo_result |
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
- hosts: web_servers | |
tasks: | |
- shell: /usr/bin/foo | |
register: foo_result | |
ignore_errors: True |
OlderNewer