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
HelgeSverre / main.dart
Created Nov 2, 2019
utf8 decode error
View main.dart
import 'dart:convert';
import 'dart:typed_data';
void main() {
var name = "A string containing ø";
var bytes = Uint8List.fromList(name.codeUnits);
var decoded = json.decode(utf8.decode(bytes));
print(decoded);
@HelgeSverre
HelgeSverre / example.js
Created Jul 17, 2016
FullCalendar remember selected View
View example.js
// Get defaultView from LocalStorage, fallback on basicWeek if it is not set yet.
var defaultView = (localStorage.getItem("fcDefaultView") !== null ? localStorage.getItem("fcDefaultView") : "basicWeek");
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultView: defaultView,
viewRender: function (view, element) {
View gist:33361e8a283624dfbbd6
powershell [Console]::Beep(658, 125); [Console]::Beep(1320, 500); [Console]::Beep(990, 250); [Console]::Beep(1056, 250); [Console]::Beep(1188, 250); [Console]::Beep(1320, 125); [Console]::Beep(1188, 125); [Console]::Beep(1056, 250); [Console]::Beep(990, 250); [Console]::Beep(880, 500); [Console]::Beep(880, 250); [Console]::Beep(1056, 250); [Console]::Beep(1320, 500); [Console]::Beep(1188, 250); [Console]::Beep(1056, 250); [Console]::Beep(990, 750); [Console]::Beep(1056, 250); [Console]::Beep(1188, 500); [Console]::Beep(1320, 500); [Console]::Beep(1056, 500); [Console]::Beep(880, 500); [Console]::Beep(880, 500); sleep -m 250; [Console]::Beep(1188, 500); [Console]::Beep(1408, 250); [Console]::Beep(1760, 500); [Console]::Beep(1584, 250); [Console]::Beep(1408, 250); [Console]::Beep(1320, 750); [Console]::Beep(1056, 250); [Console]::Beep(1320, 500); [Console]::Beep(1188, 250); [Console]::Beep(1056, 250); [Console]::Beep(990, 500); [Console]::Beep(990, 250); [Console]::Beep(1056, 250); [Console]::Beep(1188, 500); [
@HelgeSverre
HelgeSverre / kikUserEnum.py
Created Jan 5, 2016
KIK Username Enumeration Script
View kikUserEnum.py
#!/usr/bin/env python
# KIK.me Username Enumerator
import os
import sys
import requests
def main():
base_url = "http://kik.me/"
@HelgeSverre
HelgeSverre / craft-save-plugin-settings.php
Last active Apr 4, 2018
How to update a setting attribute for a CraftCMS plguin
View craft-save-plugin-settings.php
<?php
$plugin = craft()->plugins->getPlugin('pluginHandle');
// This does NOT work.
$plugin->getSettings()->setAttribute("attributename", "attribute value");
// Do this instead!
View google-scraper.php
<?php
require_once "./vendor/autoload.php";
$client = new Goutte\Client();
$keywords = "helge sverre";
$crawler = $client->request('GET', 'https://www.google.no/search?q=' . urlencode($keywords));
View TenantHostnameScope.php
<?php
namespace App\Http\Middleware;
use App\Tenant;
use Closure;
use HipsterJazzbo\Landlord\Facades\Landlord;
class TenantHostnameScope
{
View TenantScope.php
<?php
namespace App\Http\Middleware;
use App\User;
use Auth;
use Closure;
use HipsterJazzbo\Landlord\Facades\Landlord;
class TenantScope
@HelgeSverre
HelgeSverre / retry-for-loop.php
Created Feb 15, 2017
Simple Retrying for loop example
View retry-for-loop.php
<?php
$retries = 0;
$maxRetries = 3;
// Should fail this amount of times
$failCounter = 5;
for($i = 0; $i < 10; $i++) {
@HelgeSverre
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
$(this).siblings().removeClass("active");
$(this).toggleClass("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")
You can’t perform that action at this time.