Skip to content

Instantly share code, notes, and snippets.

Create the following list of items: Apples, Cherries, Pears, Pineapple, Peaches, Mango. Then print the list
Add "Grapes" to the list and print the list
Change "Pears" to "Strawberries" and print the list
Remove "Apples" from the list and print the list
Print out the current length of the list
Order the list alphabetically
Print out the list again
@jacobwyke
jacobwyke / nginx.pp
Created June 26, 2018 23:41
question 10
class custom_nginx {
package { 'nginx':
ensure => latest,
}
file { '/etc/nginx/nginx.conf':
source => 'puppet:///modules/custom_nginx/etc/nginx/nginx.conf',
group => 'root',
owner => 'root',
@jacobwyke
jacobwyke / 3.sh
Created June 26, 2018 19:09
Question 3
#!/bin/bash
# Run a bunch of checks on the data entered
if [ "$#" -lt 2 ] || [ "$#" -gt 2 ]
then
echo "Usage '$0 <starting number> <ending number>'";
exit;
fi
if [ $1 -lt 0 ]
@jacobwyke
jacobwyke / 2.php
Created June 26, 2018 18:47
Question2
<?php
/*
* File data:
* aaa jkj dfd qwerty
* fff aaa bbb qwerty
* jkj dfd bbb
* aaa aaa aaa qwerty
*
* Usage: php 2.php data.txt
*
@jacobwyke
jacobwyke / question1-alt.js
Created June 26, 2018 18:22
Question 1 Alternate
function getNestedObjectValue(objObject, strKey) {
//split the key into parts
let arrParts = strKey.split('/');
//get array length before loop for optimisation
let numLength = arrParts.length;
//create variable to hold object position
let mixValue = objObject;
@jacobwyke
jacobwyke / question1.js
Created June 26, 2018 18:17
Question 1: As given
function getNestedObjectValue(objObject, strKey) {
//split the key into parts
let arrParts = strKey.split('/');
//get array length before loop for optimisation
let numLength = arrParts.length;
//create variable to hold object position
let mixValue = objObject;
<data-source :source="https://dataprovider">
<div slot-scope="{ items }">
<data-show-item :item="item" v-for="item in items" />
</div>
</data-source>
@jacobwyke
jacobwyke / DataSource.vue
Created June 6, 2018 13:07
Vue.js data source component for just in time (JIT) data display
<script>
export default {
name: 'data-source',
props: {
source: {
type: String,
required: true
}
},
data: function() {
@jacobwyke
jacobwyke / newpost.sh
Created February 7, 2018 07:41
Bash script to add a new Jekyll post with the correct file name and front matter
#!/bin/bash
strBaseFolder=`pwd`/
strDate=`date +"%Y-%m-%d"`
strTime=`date +"%H:%M:%S %z"`
if [ "$#" == 0 ] || [ "$#" -gt 1 ] ; then
echo "Usage: $0 'post title'"
exit;
fi