Skip to content

Instantly share code, notes, and snippets.

# Recipe for scala-2.10.1
require 'formula'
class ScalaDocs < Formula
homepage 'http://www.scala-lang.org/'
url 'http://www.scala-lang.org/downloads/distrib/files/scala-docs-2.10.1.zip'
sha1 '7ff73776f7af9d6b2d5081a3a6ffa2a442640a59'
end
// http://stackoverflow.com/questions/16617003/how-do-i-short-this-scala-code
trait TurkishCitizenshipNumberValidator {
def turkishCitizenshipNumberValidator(t: String): Boolean = {
if (t.length != 11 || !t.forall(_.isDigit)) false
else {
val n = t.map(_.asDigit)
val evens = n.grouped(2).take(5).map(_(0)).sum
val odds = n.grouped(2).take(4).map(_(1)).sum
n(10) == (n.take(10).sum % 10) && n(9) == ((evens * 7 - odds) % 10)
package com.hasanozgan.utils;
/**
* Algoritma
* a] 1. 3. 5. 7. ve 9. basamaklarının sayı değerleri toplamının 7 katından, 2. 4. 6. ve 8. basamaklarının sayı değerleri toplamı çıkartılır. Elde edilen sonucun 10′a bölümünden kalan(yani mod10) kimlik numaralarımızın 10. basamağına eşittir.
* b] 1. 2. 3. 4. 5. 6. 7. 8. 9. ve 10. basamaklarının sayı değerleri toplamı 10′a bölünür. Elde edilen kalan(yani mod10) bize kimlik numaralarımızın 11. basamağını verir.
*/
public class TurkeyCitizenshipIdentityValidator {
final static String TC_KIMLIK_NO_PATTERN = "[1-9][0-9]{10}";
@netologist
netologist / sbt-package
Created October 2, 2013 08:05
sbt package dependency
packageOptions in (Compile, packageBin) <+= (target, externalDependencyClasspath in Runtime) map
{ (targetDirectory: File, classpath: Classpath) =>
val relativePaths = classpath map { attrFile: Attributed[File] => targetDirectory.toPath().relativize(attrFile.data.toPath()).toString() };
Package.ManifestAttributes(java.util.jar.Attributes.Name.CLASS_PATH -> relativePaths.reduceOption(_ + " " + _).getOrElse(""))
}
ISTATISTIK
http://www.indeed.com/jobtrends?q=angularjs%2Cbackbonejs%2Cemberjs%2Cjquery&l=
http://www.google.com/trends/explore#q=angularjs%2C%20backbonejs%2C%20emberjs%2C%20jquery&cmpt=q
Hype Cycle (Garthner)
http://www.crminnovation.com/blog/wp-content/uploads/2012/09/HypeCycle.png
technology trigger / teknoloji tetiklemesi
@netologist
netologist / gist:9066621
Created February 18, 2014 08:10
angular
AngularJS Öğreniyorum
==================
A bunch of links to blog posts, articles, videos, etc for learning AngularJS. This list is in its early stages. Feel free to submit a pull request if you have some links/resources to add. Also, I try to verify that the articles below have some real content (i.e. aren't 2 paragraph blog posts with little information) to ensure I'm not listing "fluff" pieces. If you have an idea for a better way to organize these links, please let me know. As I find similar posts in the "General Topics" section, I will break them out into their own categories.
## Kitaplar
* [AngularJS] (http://shop.oreilly.com/product/0636920028055.do)
* [AngularJS'e Hızlı Başlangıç] (http://www.packtpub.com/angularjs-to-build-dynamic-web-applications/book)
* [AngularJS ile Tarifler] (https://leanpub.com/recipes-with-angular-js)
* [Örneklerle AngularJS] (http://www.manning.com/bford/)
<?php
function get_ip_address() {
$ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR');
foreach ($ip_keys as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
// trim for safety measures
$ip = trim($ip);
// attempt to validate IP
if (validate_ip($ip)) {
@netologist
netologist / prompt-example.scala
Created August 7, 2014 07:03
Scala Prompt Sample
// Works Scala 2.11
import scala.io.StdIn._
object Main extends App {
var items:List[String] = List.empty
var ok = true
while(ok) {
print("> ")
@netologist
netologist / BaseDAO.scala
Last active August 29, 2015 14:05
Slick Example
import com.typesafe.config.ConfigFactory
import scala.slick.jdbc.JdbcBackend.Database
class BaseDAO {
lazy val conf = ConfigFactory.load()
lazy val uri = conf.getString(s"spray.oauth2.datasource.uri")
lazy val user = conf.getString(s"spray.oauth2.datasource.username")
lazy val password = conf.getString(s"spray.oauth2.datasource.password")
lazy val driver = conf.getString(s"spray.oauth2.datasource.driver")