Skip to content

Instantly share code, notes, and snippets.

@skooltch84
skooltch84 / Shuffle.playground
Created February 8, 2018 22:22
shuffle arrays in swift
//: Playground - noun: a place where people can play
import UIKit
//1. create an array
var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//2. initialize an empty array
var emptyArray = [Int]()
@skooltch84
skooltch84 / Quizbook.java
Created February 14, 2017 03:00
Shuffle objects in an array
package objects;
import java.util.Arrays;
import java.util.Collections;
public class Quizbook {
String mQuestion;
boolean mAnswer;
@skooltch84
skooltch84 / Add Custom Calendar to a Fragment
Created February 10, 2017 23:27
This fragment uses the sundeepk compact calendar view
package com.blogspot.skooltchdev.christchurchgirls;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
@skooltch84
skooltch84 / gist:661d701cbf56841c92454a3d139c391d
Created January 28, 2017 15:54
Android Studio: Create a Ripple Effect for a Button
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorAccent">
<item>
<shape
android:shape="rectangle">
<solid android:color="#4CAF50" />
</shape>
</item>
@skooltch84
skooltch84 / gist:256346a8c4d85b1bd2445b4e711ea7b8
Created January 9, 2017 20:26
Code for multiple choice button
//Start of Button Listener for Button1
mButtonChoice1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
//My logic for Button goes in here
if (mButtonChoice1.getText() == mAnswer){
mScore = mScore + 1;
updateScore(mScore);
Toast.makeText(QuizActivity.this, "correct", Toast.LENGTH_SHORT).show();
@skooltch84
skooltch84 / Highlight_Calendar_Main_Activity
Created October 18, 2016 12:54
Java Code used in my Highlight Events Calendar
package com.blogspot.skooltchdev.highlightcalendar;
import android.content.Context;
import android.graphics.Color;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import com.github.sundeepk.compactcalendarview.CompactCalendarView;
class Car {
public readonly int NumberOfWheels; //readonly keyword doesn't allow user to change the values
private readonly int NumberOfDoors
//Car Constructor Method which takes parameters of NumberOfWheels and NumberOfDoors
public Car(int NumberOfWheels, int NumberOfDoors){
//Initializing the fields with method level variables
class Car {
}
//Creating an instance of the car class
// also called a Car instance or creating a car object
//Therefore an object is an instance of a class
//An instance is basically an object.
@skooltch84
skooltch84 / main.cs
Created September 24, 2016 20:09
Writing to the console
static void Main() {
System.Console.Write("What is your favourite animal?");
}
@skooltch84
skooltch84 / example.cs
Last active September 24, 2016 17:07
My First bit of C# Code
//This is a comment.
//This class is about mammals.
class Mammals
{
static void Main()
{
}
}