Skip to content

Instantly share code, notes, and snippets.

View SGudbrandsson's full-sized avatar

Sigurður Guðbrandsson SGudbrandsson

View GitHub Profile

Staðfestu staðhæfingarnar þínar.

Ég þarf að vita nákvæm gögn.

Skoðaðu upprunalegar heimildir fyrst, eins og heimasíðu þess sem er verið að tala um. Ef þú færð lista, teldu gögnin. Ef þú ert með heimild úr skjali, vitnaðu í skjalið með hlekk.

Ekki gera mistök.

Farðu yfir gögnin þín áður en þú kemur með svar.

@SGudbrandsson
SGudbrandsson / lists.cs
Created September 8, 2024 10:27
C# Lists Example
List<int> grades = new List<int> { 85, 90, 78, 92 };
Console.WriteLine("Grades: " + string.Join(", ", grades));
grades.Add(88); // Adding a new grade
Console.WriteLine("Grades: " + string.Join(", ", grades));
int highestGrade = grades[3]; // Accessing the grade at index 3
grades.RemoveAt(2); // Removing the grade at index 2 (which is 78)
Console.WriteLine("Grades: " + string.Join(", ", grades));
@SGudbrandsson
SGudbrandsson / .bash_aliases
Last active December 21, 2018 09:44
Bash quick function for lighthouse audits (skipping network load)
#
# Run a lighthouse audit and open it in a new tab in Chrome
# This uses Docker for consistency
# Only the performance test is run
#
# USAGE:
# lighthouse production mobile https://google.com
# lighthouse mobile https://google.com
# lighthouse desktop https://google.com
#
@SGudbrandsson
SGudbrandsson / ORM.php
Last active February 11, 2016 13:11
Kohana 3.3 ORM extension for safe database transactions
<?php defined('SYSPATH') OR die('No direct script access.');
class ORM extends Kohana_ORM {
/**
* Set to true if you are creating a new transaction
* Set to false once you commit or rollback.
*
* @author Sigurdur
*/
@SGudbrandsson
SGudbrandsson / 404checker.js
Last active August 29, 2015 14:27 — forked from n1k0/404checker.js
A CasperJS script to check for 404 & 500 internal links on a given website
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/
@SGudbrandsson
SGudbrandsson / index.php
Last active September 5, 2024 01:54
Create a WordPress staging area from your live wordpress setup with a Click-of-a-button [TM] ..
<?php
/**
*
* This script will copy your wordpress from public_html (or wherever)
* and place it in a staging folder.
* It will then clone the database, reconfigure the config file
* and replace URL's from the original URL to your staging URL.
* It will then make sure to NOT allow search engines to index the page.
*
* Use this script to clone your main wp in order to test maintenance work
<?php
/**
* Template Name: Discourse SSO
* Author: Adam Capriola
* Version: 1.1
* Author URI: https://meta.discourse.org/users/AdamCapriola/activity
* Adapted From: https://github.com/ArmedGuy/discourse_sso_php
* Uses: https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045
*
*/