Skip to content

Instantly share code, notes, and snippets.

Helge Sverre HelgeSverre

Block or report user

Report or block HelgeSverre

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
HelgeSverre / MY_Loader.php
Created Mar 27, 2015
Template loading function for CodeIgniter 3.x
View MY_Loader.php
* Template loading function for CodeIgniter 3.x
* Location: application/core/MY_Loader.php
* Class MY_Loader
class MY_Loader extends CI_Loader
View download-zip.php
// imagine $imageIds is a get parameter with a comma seperated string of ID's
// Eample: http://localhost/download-zip?images=1,2,3,4
Route::get("/download-zip", function ($images) {
$imageIds = explode(",", $images);
// This is an eloquent model
View pdf-conversion.php
Assuming that all the data is the same "form", we can simply grab the data from the request
and render it as HTML, then convert that HTML doument to a PDF using the DomPDF library.
// Grab the request data
$request = $_POST;
View array.php
$anArray = [
"stuff" => "stuff",
"stuff2" => "stuff",
"stuff3" => "stuff",
"stuff4" => "stuff",
HelgeSverre / filter.js
Last active Feb 14, 2017
Simple class based jaavascript filtering solution using data attributes
View filter.js
$(".filters .filters__wrapper ul").on("click", "li", function () {
// Set clicked element as active
// Get the class to filter by
var filterClass = $(this).data("filter").trim();
// Get the grid this filter applies to (use data-grid="#some-id-here")
HelgeSverre / retry-for-loop.php
Created Feb 15, 2017
Simple Retrying for loop example
View retry-for-loop.php
$retries = 0;
$maxRetries = 3;
// Should fail this amount of times
$failCounter = 5;
for($i = 0; $i < 10; $i++) {
View TenantScope.php
namespace App\Http\Middleware;
use App\User;
use Auth;
use Closure;
use HipsterJazzbo\Landlord\Facades\Landlord;
class TenantScope
View TenantHostnameScope.php
namespace App\Http\Middleware;
use App\Tenant;
use Closure;
use HipsterJazzbo\Landlord\Facades\Landlord;
class TenantHostnameScope
View google-scraper.php
require_once "./vendor/autoload.php";
$client = new Goutte\Client();
$keywords = "helge sverre";
$crawler = $client->request('GET', '' . urlencode($keywords));
You can’t perform that action at this time.