Skip to content

Instantly share code, notes, and snippets.

View mortenson's full-sized avatar
💧
Did you try to clear cache?

Samuel Mortenson mortenson

💧
Did you try to clear cache?
View GitHub Profile
$service = New-WebServiceProxy -Uri http://143.166.84.118/services/assetservice.asmx?WSDL
if($args.count -ne 0){
$serial = $args[0]
}
else{
$system = Get-WmiObject win32_SystemEnclosure
$serial = $system.serialnumber
}
$guid = [guid]::NewGuid()
$info = $service.GetAssetInformation($guid,'check_warranty.ps1',$serial)
@mortenson
mortenson / gist:10dbe3c4c55b41a238bd
Created May 9, 2015 17:04
Drupal subtree example
$ cd drupal-multisite-subtree
$ ### This is a basic Drupal 7 install
$ ls
CHANGELOG.txt INSTALL.txt authorize.php misc sites
COPYRIGHT.txt LICENSE.txt cron.php modules themes
INSTALL.mysql.txt MAINTAINERS.txt includes profiles update.php
INSTALL.pgsql.txt README.txt index.php robots.txt web.config
INSTALL.sqlite.txt UPGRADE.txt install.php scripts xmlrpc.php
$ ### Lets add a new multisite
$ git subtree add --prefix sites/site1 git@github.com:mortenson/site1.git master
@mortenson
mortenson / gist:9b15098b26610afac929
Created May 9, 2015 17:59
Drupal subtree site1 PR
$ ### Checkout and push a new branch
$ git checkout -b site1-update
Switched to a new branch 'site1-update'
$ git push -u origin site1-update
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:mortenson/drupal-multisite-subtree.git
* [new branch] site1-update -> site1-update
Branch site1-update set up to track remote branch site1-update from origin.
$ ### Update the site1 subtree
$ git subtree pull --prefix sites/site1 git@github.com:mortenson/site1.git master
@mortenson
mortenson / index.html
Created September 8, 2015 20:05
Refresh current path in JS every 5 seconds (try it out by editing the content of body)
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
$(function() {
if (typeof init === 'undefined') {
init = true;
setInterval(function () {
$.get('', function (data) {
var doc = document.open('text/html', 'replace');
@mortenson
mortenson / entity-browser-image-support.patch
Created January 15, 2016 18:17
Is it really that easy?
diff --git a/src/Plugin/Field/FieldWidget/EntityReference.php b/src/Plugin/Field/FieldWidget/EntityReference.php
index 004ab98..935c05f 100644
--- a/src/Plugin/Field/FieldWidget/EntityReference.php
+++ b/src/Plugin/Field/FieldWidget/EntityReference.php
@@ -33,7 +33,8 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
* description = @Translation("Uses entity browser to select entities."),
* multiple_values = TRUE,
* field_types = {
- * "entity_reference"
+ * "entity_reference",
@mortenson
mortenson / photobooth.py
Last active April 17, 2016 18:20
Stupid simple script for taking photobooth-style pictures in Python 2.7+ using OpenCV 3+ and Pillow.
import cv2
import time
import sys
import PIL
from PIL import Image
from PIL import ImageOps
# "0" is the port of your built-in webcam, probably.
camera_port = 0
# Number of frames to ramp-up the camera.
@mortenson
mortenson / DebugTest.php
Created May 18, 2016 17:49
Debugging Drupal 8 Javascript tests
<?php
class DebugTest extends YourBrokenTest {
/**
* Overrides a broken test method and saves HTML at the point of failure.
*/
public function testName() {
try {
parent::testName();
@mortenson
mortenson / composer.json
Last active August 20, 2023 10:39
Example composer.json file for File Browser
{
"name": "mortenson/example",
"minimum-stability": "dev",
"authors": [
{
"name": "Samuel Mortenson",
"email": "samuel.mortenson@acquia.com"
}
],
"repositories": [
@mortenson
mortenson / Dockerfile
Last active August 7, 2016 17:43
No-interaction Drupal 8 standard install with Docker
# Extend the official Drupal image.
FROM drupal:8.1.7-apache
# Install required binaries.
RUN apt-get update && apt-get install netcat mysql-client -y
# Safely remove the normal modules directory.
RUN rm /var/www/html/modules/README.txt && rmdir /var/www/html/modules
# Install Composer.
@mortenson
mortenson / docker-compose.yml
Created August 7, 2016 17:44
Minimal Docker Compose file for Drupal 8
version: '2'
services:
web:
build: .
ports:
- "8000:80"
volumes:
- ./modules:/var/www/html/modules
- ./files:/var/www/html/sites/default/files
links: