Skip to content

Instantly share code, notes, and snippets.

View SeanTRobinson's full-sized avatar

Sean Robinson SeanTRobinson

View GitHub Profile
@SeanTRobinson
SeanTRobinson / setup-ubuntu_14.04-dellxps13.sh
Last active August 10, 2016 16:00
A script to fix the issues trying to get Ubuntu 14.04 running on the Dell XPS 13 1950 laptops.
#!/usr/bin/env bash
echo "================================"
echo "Dell XPS 13 1950 Fixes for Ubuntu 14.04"
echo "================================"
echo "Downloading required files"
echo "--------------------------------"
mkdir patch/
cd patch/
@SeanTRobinson
SeanTRobinson / ScopeSafe_WithProto_Constuction.js
Created September 10, 2014 09:00
A scope safe object creation example with a clean prototype manipulation.
function Book(isbn, title, author) {
if (this instanceof Book) {
this.isbn = isbn;
this.title = title;
this.author = author;
} else {
return new Book(isbn, title, author);
}
}
@SeanTRobinson
SeanTRobinson / ScopeSafeConstructor
Last active August 29, 2015 14:05
If somebody forgets to call a constructor with 'new', then 'this' refers to the global scope. When you assign properties within the constructor, you are instead augmenting the global scope. The following pattern helps stop that from happening.
function Book(isbn, title, author) {
if(this instanceof Book) {
this.isbn = isbn;
this.title = title;
this.author = author;
} else {
return new Book(isbn, title, author);
}
}
@SeanTRobinson
SeanTRobinson / ConfluenceBackup.sh
Last active June 6, 2022 14:58
Backup Atlassian Jira and Confluence from the command line.
#!/bin/bash
USERNAME=<username>
PASSWORD=<password>
INSTANCE="<company>.atlassian.net"
LOCATION="./Backups/"
mkdir "Backups"
# Grabs cookies and generates the backup on the UI.
@SeanTRobinson
SeanTRobinson / SieveOfEratosthenes.cs
Last active August 29, 2015 14:01
A C# implementation of the Sieve of Eratosthenes algorithm.
namespace SieveOfEratosthenes
{
class SieveOfEratosphenes
{
public static void printPrimesUntil(int n)
{
List<int> primes = getPrimesUntil(n);
printList(primes);
}
@SeanTRobinson
SeanTRobinson / PascalTriangleCreator.cs
Last active August 29, 2015 14:01
Generates a Pascal Triangle in an array structure.
private static int[, ] createTriangle(int size)
{
int[,] triangle = new int[size,size];
for (int i = 0; i < size; i++)
{
triangle[i, 0] = 1;
for (int j = 1; j < i; j++)
{
triangle[i, j] = triangle[i-1, j-1] + triangle[i-1, j];
}
@SeanTRobinson
SeanTRobinson / CStackGrowthCheck.cs
Last active August 29, 2015 14:01
Determines whether the stack grows upwards or downwards.
#include <iostream>
class MethodCaller {
public:
static int getMemoryAddress() {
int var = 2;
return var;
}
};