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 | |
class ftpDelete { | |
const TEMP_DIRECTORY = '/Temp'; | |
const PASSIVE = true; | |
const ACTIVE = false; | |
private $connection; |
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 FizzBuzz { | |
def getResult( value:Int ) : String = { | |
value % 3 -> value % 5 match { | |
case ( 0, 0 ) => "fizzbuzz" | |
case ( 0, _ ) => "fizz" | |
case ( _, 0 ) => "buzz" | |
case _ => value.toString | |
} | |
} | |
} |
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
def expected = "text/plain"; | |
mock = new MockFor( HttpServletResponse.class ); | |
mock.demand.with { | |
setContentType{ String got -> assert expected == got } | |
} | |
def mockHttpServletResponse = mock.proxyInstance(); | |
def themeWriter = new ThemeWriter( mockHttpServletResponse ); | |
themeWriter.generateResponse(); | |
mock.verify( mockHttpServletResponse ); |
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
using UnityEngine; | |
using System.Collections; | |
public class GlowCycle : MonoBehaviour { | |
private Material _objMaterial; | |
private int _shaderPropertyId; | |
IEnumerator IntensityCycle(float start, float end) { | |
for (float i = 0f; i <= 1.0f; i += 0.1f) { |
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
def sheep(name: String, age: Int) = { println(name + " is aged " + age)} | |
// error, the compiler cannot determine what you want to do | |
//val badger = sheep | |
val cow = sheep(_,_) | |
val dog = sheep _ | |
sheep("Dolly", 10) |
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
var fibCache = [0, 1]; | |
var yourself = { | |
fibonacci : function(n) { | |
if (n <= 1) { | |
return n; | |
} | |
if (!fibCache[n]) { | |
fibCache[n] = this.fibonacci(n - 1) + | |
this.fibonacci(n - 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
from PyPDF2 import PdfFileWriter, PdfFileReader | |
import sys | |
pages_to_remove = [0] | |
if len(sys.argv) < 3: | |
raise ValueError("A source and destination file need to be supplied") | |
infile_name = sys.argv[1] | |
outfile_name = sys.argv[2] | |
infile = PdfFileReader(infile_name) | |
output = PdfFileWriter() |
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
case class CsvWithHeadersExtractor( text: List[ String ] ) { | |
val head = removeQuotations( text.map( x => x.split( "," ).toList ).head ) | |
val list = for { | |
tail <- text.map( x => x.split( "," ).toList ).tail | |
} yield { | |
head zip removeQuotations( tail ) | |
} | |
def filterByField( columnName: String ): List[ String ] = { |
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
sudo apt-get update | |
sudo apt-get install update-manager-core | |
do-release-upgrade |
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
lsb_release -a |
OlderNewer