Skip to content

Instantly share code, notes, and snippets.

View PetterKraabol's full-sized avatar

Petter Kraabøl PetterKraabol

View GitHub Profile
@PetterKraabol
PetterKraabol / chatreplay.py
Last active February 20, 2021 19:27
ChatReplay (Moved)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests, sys, time
#
# DEPENDENCIES
#
# You'll need the Requests library: http://docs.python-requests.org/en/master/user/install/#install
#
@PetterKraabol
PetterKraabol / Preferences.sublime-settings
Last active January 23, 2017 23:51
Sublime Text 3 Preferences
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/ayu/ayu-mirage.tmTheme",
"findreplace_small": true,
"folder_exclude_patterns":
[
".svn",
@PetterKraabol
PetterKraabol / jsonReader.js
Last active August 29, 2015 14:27
Asynchronous JSON reader
var fs = require('fs');
// Read data from file
exports.read = function(file, callback){
fs.readFile(file, function(err, dataString){
if(err) callback(err);
var data = JSON.parse(dataString, function(key, value){
return value;
});
@PetterKraabol
PetterKraabol / flights.json
Created July 6, 2015 16:48
Random Generated Flights Example
This file has been truncated, but you can view the full file.
[{"name":"Fixsolzim Airways","capacity":20,"airport":{"city":"lineware","name":"Modern Flannel Airport","capacity":10,"x":886,"y":165},"flight":[{"origin":{"city":"lineware","name":"Modern Flannel Airport","capacity":10,"x":886,"y":165},"destination":{"city":"danbam","name":"Pottery Stormy Airport","capacity":10,"x":505,"y":826},"departure":"2015-07-06T20:37:00.000Z","arrival":"2015-07-07T22:08:53.158Z"},{"origin":{"city":"danbam","name":"Pottery Stormy Airport","capacity":10,"x":505,"y":826},"destination":{"city":"Cityhigh","name":"Grim Leather Airport","capacity":10,"x":196,"y":584},"departure":"2015-07-08T05:15:00.000Z","arrival":"2015-07-08T18:37:58.280Z"},{"origin":{"city":"Cityhigh","name":"Grim Leather Airport","capacity":10,"x":196,"y":584},"destination":{"city":"Subtrax","name":"Pointless Waterbird Airport","capacity":10,"x":859,"y":471},"departure":"2015-07-09T00:23:00.000Z","arrival":"2015-07-09T23:04:07.293Z"},{"origin":{"city":"Subtrax","name":"Pointless Waterbird Airport","capacity":10,"x":859,"
@PetterKraabol
PetterKraabol / flights.js
Last active August 29, 2015 14:24
Random Generated Flight Schedules
// Written by Petter Kraabøl
function Airport (city, name, capacity, x, y){
this.city = city; // City name
this.name = name; // Airport Name
this.capacity = capacity; // Plane capacity
this.x = x; // x coordinate
this.y = y; // y coordinate
}
@PetterKraabol
PetterKraabol / TicTacToe.as
Last active December 18, 2015 04:19
This is one of my old Tic-Tac-Toe game code in ActionScript3. I suggest not to use it, as it is horrible and repeating.
import flash.events.MouseEvent;
stop();
var currentPlayer = "x";
//Initial
var newSymbol;
var ownerA1 = "none";
var ownerA2 = "none";
var ownerA3 = "none";
var ownerB1 = "none";
@PetterKraabol
PetterKraabol / contentSlider.js
Last active December 18, 2015 01:09
This jQuery function slides a container out to the right, and comes back in from the left. jsFiddle: http://jsfiddle.net/Zarlach/wxHLP/
function slideContent(ele){
ele.animate({
opacity: 0,
marginLeft: '+=500'
}, 500, function() {
$(this).css('marginLeft', 'auto').css('marginRight', '+=500');
$(this).animate({
marginRight: '-=500',
opacity:1
}, 500, function(){