Skip to content

Instantly share code, notes, and snippets.

View OzanKurt's full-sized avatar
🍻
Cheers!

Ozan Kurt OzanKurt

🍻
Cheers!
View GitHub Profile
@irazasyed
irazasyed / weight-utility.php
Created January 8, 2016 09:21
PHP: Utility function for getting random values with weighting.
<?php
/**
* getRandomWeightedElement()
* Utility function for getting random values with weighting.
* Pass in an associative array, such as array('A'=>5, 'B'=>45, 'C'=>50)
* An array like this means that "A" has a 5% chance of being selected, "B" 45%, and "C" 50%.
* The return value is the array key, A, B, or C in this case. Note that the values assigned
* do not have to be percentages. The values are simply relative to each other. If one value
* weight was 2, and the other weight of 1, the value with the weight of 2 has about a 66%
* chance of being selected. Also note that weights should be integers.
@anaxamaxan
anaxamaxan / URL.php
Created August 22, 2014 01:11
Allow curly braces in Laravel URL::route() parameters array
<?php namespace Cego\Facades;
class URL extends \Illuminate\Support\Facades\URL
{
public static function route($name, $parameters = array(), $absolute = true, $route = null)
{
$urlGenerator = static::$app['url'];
/* @var \Illuminate\Routing\UrlGenerator $urlGenerator */
$route = $urlGenerator->route($name, $parameters, $absolute, $route);
@tpitale
tpitale / scrollbar_example.css
Created December 17, 2010 19:11
Super simple scrollbars for webkit similar to iOS
#sidebar ul.customers::-webkit-scrollbar {
width: 5px;
}
#sidebar ul.customers::-webkit-scrollbar-thumb:vertical {
margin: 5px;
background-color: #999;
-webkit-border-radius: 5px;
}