Skip to content

Instantly share code, notes, and snippets.

Aivaras Voveris farico

Block or report user

Report or block farico

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ip.scala
import collection.mutable.ListBuffer
object NetworkUtils {
def ip2Long(ip: String): Long = {
val atoms: Array[Long] = ip.split("\\.").map(java.lang.Long.parseLong(_))
val result: Long = (3 to 0 by -1).foldLeft(0L)(
(result, position) => result | (atoms(3 - position) << position * 8))
result & 0xFFFFFFFF
}
View business-models.md

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@farico
farico / gist:3938084
Created Oct 23, 2012
Linksniavimas LT vardu
View gist:3938084
<?php
/**
* Lietuviškų vardų linksniai.
*
* @author Maug Lee <mauglee@gmail.com>
* @copyright Copyleft (ↄ) 2011, Maug Lee
* @version 0.3
* @package Vardai
*/
@farico
farico / hack.sh
Created Mar 31, 2012 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
View gist:769495
function linksnis($skaicius, $komentaras, $komentarai, $komentaru) {
if ( $skaicius % 10 == 0 || between(substr($skaicius, -2), 10, 20) ) {
return $komentaru;
}
elseif ( substr($skaicius, -1) == 1 && $skaicius != 11 ) {
return $komentaras;
}
View isset_assign
function isset_assign( $needle, $haystack ) {
if ( isset( $haystack[$needle] ) ) {
return $haystack[$needle];
}
else {
return $needle;
}
}
View array_has.php
<?php
/**
* isset( $var['a'], $var['b'] ) shortcut: array_has( $var, 'a', 'b' );
*/
function array_has( &$var ) {
$args = func_get_args();
if ( ! empty( $args ) && is_array( $args[0] ) && count( $args ) > 1 ){
You can’t perform that action at this time.