Skip to content

Instantly share code, notes, and snippets.

View ravenberg's full-sized avatar
✌️
Always eager

Lee Ravenberg ravenberg

✌️
Always eager
View GitHub Profile
@ravenberg
ravenberg / gist:0eafa910b58fd6807cfe
Created November 14, 2014 10:07
Java math: Generate a random positive or negative integer in a given range.
int randomInteger = -10 + (int) (Math.random() * ((10 - (-10)) + 1));
@ravenberg
ravenberg / gist:8882d7503ec7cc5977fd
Created December 2, 2014 15:11
Welzorg Android
package nl.dtt.welzorgpechhulp;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapsInitializer;
@ravenberg
ravenberg / Defaultcontroller.php
Created November 8, 2015 15:51
Symfony routing: annotations
<?php
namespace Laurora\HelloWorldBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class DefaultController extends Controller
{
@ravenberg
ravenberg / 0_reuse_code.js
Created November 26, 2015 08:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/* Ugly fix to remove list float
-----------------------------------------------------------*/
@media screen and (max-width: 550px) {
.products .thumbnail-container {
margin-bottom: 0px !important;
}
.woocommerce ul.products li.product{
float: none !important;
}
}
http://api.jquery.com/submit/
def get_hash(name)
readsize = 64 * 1024
File.open(name, 'rb') do |f|
size = File.size?(name)
data = f.read(readsize)
f.seek(-readsize, IO::SEEK_END)
data += f.read(readsize)
return Digest::MD5.hexdigest(data)
end
end
<?php
header('WWW-Authenticate: Basic realm="HN-Cloud"');
header('HTTP/1.0 401 Unauthorised');
def greet(name):
print 'Hello', name