This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(fn) | |
{ | |
var n=fn.split(" "), // Split the full name into an array | |
it="", // Create and set the intials variable to nothing | |
i; // Set i to 0 for the while loop | |
while(i<n.length) // While loop that runs while i is smaller than the length of the array of names | |
{ | |
it+=n[i][0]; // Get the first letter from the name and add it to the it(initial) variable | |
i++ // Increment i by 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function() | |
{ | |
var l=["A","B","C","D","E","F",0,1,2,3,4,5,6,7,8,9], // We declare our list with all the possible characters that can be used | |
c="", // Our variable we are going to use to store our final hex colour in | |
i=0; // The i variable we will use in our while loop | |
while(i<6) // Loop the code 6 times so that we get a 6-byte string (i.e. the hex colour) | |
{ | |
c+=l[Math.floor(Math.random()*16)]; // Get a random value from the list | |
i++ // Increment i by 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script simply searches for all instances of a search term and replaces tgem with supplied text | |
# Ivan Kahl, 28 April 2015 | |
import console | |
import editor | |
def main(): | |
# Get the search term | |
searchFor = console.input_alert('Search Term', 'Enter the term to search for in the text file', '', 'Continue') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import console | |
import editor | |
import os | |
def main(): | |
# Get the path to the file or select the current file open in the editor | |
path = console.input_alert('File Path', 'Enter the path to the file you want to open relative to the Documents directory Leave <CURRENT> to open current file', '<CURRENT>', 'Open In') | |
# Check if text was returned | |
if not path: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static int[] SelectionSort(int[] items) | |
{ | |
// Loop through each element | |
for (int i = 0; i < items.Length - 1; i++) | |
// Loop through each element afterwards | |
for (int j = i + 1; j < items.Length; j++) | |
// Check if the first item is bigger than the second item | |
if (items[i] > items[j]) | |
{ | |
// If it is, swap the two values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static int[] BubbleSort(int[] numbers) | |
{ | |
// Create a boolean to store whether the list has been sorted or not | |
bool sorted = false; | |
do | |
{ | |
// Set our sorted value to true. This will be set to false if | |
// any values have to be swapped | |
sorted = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var | |
X, Y, Temp := Integer; | |
begin | |
Temp := X; | |
X := Y; | |
Y := Temp; | |
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Runtime.Serialization.Json; | |
using System.IO; | |
namespace JSONSerializerDesarializer | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Xml.Serialization; | |
namespace XMLSerilizationDeserialization | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int[] RemoveDuplicates(int[] items) | |
{ | |
// Create a new array to store the items with no | |
// duplicates | |
List<int> newList = new List<int> { items[0] }; | |
// Loop through every item in our items array | |
for (int i = 1; i < items.Length; i++) | |
{ | |
// Create a new boolean to determine whether |
OlderNewer