Programming

My notes on how to use git

1) create a local git repo $ git init 1.5) Save username and password for github $ git config credential.helper store $ git push http://example.com/repo.git Username: <type your username> Password: <type your password> 2) Add all the files in the currect folder $ git add * 3) Commit the files/changes $ git commit -m "first commit" 4) Add the remote repo $ git remote add github https://github-url 5) Push the local repo to the remote repo $ git push --set-upstream github master After adding files f

PHP Script to return random D&amp;D Monster name

I wanted to have a quick an easy way to get a random name, from say a list of D&D monsters. But I wanted the script to be accessible from anywhere on the network. So I wrote this simple PHP script and put it on a web server. create a new php file. paste this array into the file, inside the usual php tags. $filename = "names.txt"; $names = file($filename, FILE_IGNORE_NEW_LINES); $num = random_int(0,303); print ($names[$num]); create another file, called names.txt that contains the list of monster names. Change the 303 to the number of items in your list, minus 1 see demo
Tags:

Installing Visual Studio Code on RHEL

RHEL, Fedora, and CentOS based distributions We currently ship the stable 64-bit VS Code in a yum repository, the following script will install the key and repository: sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' Then update the package cache and install the package using dnf (Fedora 22 and above): sudo dnf check-update sudo dnf i

Getting Started with CocoaPods

Installation
  1. make sure the ruby system is up to date
    1. $ sudo gem update --system
  2. install cocoapods
    1. $ sudo gem install cocoapods
    2. If you get an error message about fuzzy_match, try this command instead,
    3. $ sudo gem install -n /usr/local/bin cocoapods
  3. setup the pods
    1. $ pod setup
To Test / use cocoa pods
  1. Create a new single view project in Xcode
  2. Quit Xcode
  3. navigate to the folder of the new proj

Connecting a second ViewContoller to another Swift file

  1. Make sure the swift file looks like the default ViewContoller.swift file i.e. import UIKit, inherits from UIViewController, have at least the viewDidLoad function
  2. Click on the yellow dot that represents the view controller in the story board
  3. Select the identify inspector page
  4. In the Class drop down at the top, you should be able to select the name of your new class NOTE: you may have to save and or compile you app to get the new class to appear on the list.

Detecting iPad or iPhone in swift

To detect if the user is using an iPad or iPhone or something else in Swift do something like this: switch UIDevice.current.userInterfaceIdiom { case .phone: deviceLavel.text = "iPhone" case .pad: deviceLavel.text = "iPad" case .unspecified: deviceLavel.text = "unspecified" case .tv: deviceLavel.text = "tv" case .carPlay: deviceLavel.text = "carPlay" }

How to record an App Preview

1. Connect your iPhone or iPad to you Mac 2. Open Quick Time Player 3. From the File menu, Choose new Movie recording 4. Fromt the drop down next to the record button choose you iphone/ipad for video and microphone 5. Click record 6. Do steps 7. Click Stop 8. File | Save 9. Add name, click Save 10. Close quick time player 11. Open imovie 12. From the File menu, choose new app preview
you may have to go back to the projects screen first 13. If you get the app previews info screen click OK 14. Drag and drop your recording from steps 1-9 into the bottom half of the iMovies window 15.

Using a bigger Range of colours from code in Unity

  Create a new C# script in your project called CSSColors.cs and then copy and paste the code below into it. You should then be able to use the colour names specified anywhere in your project. public class CSSColors { // NOTE: The follwing color names come from the CSS3 specification, // Section 4.3 Extended Color Keywords // http://www.w3.org/TR/css3-color/#svg-color public static readonly Color AliceBlue = new Color32(240,248,255,255); public static readonly Color AntiqueWhite = new Color32(250,235,215,255); public static readonly Color Aqua= new Color32(0,255,255,255); public static

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer