Skip to content

Instantly share code, notes, and snippets.

View mondalaci's full-sized avatar

László Monda mondalaci

View GitHub Profile
@mondalaci
mondalaci / get-to-post.php
Created March 30, 2014 02:23
Posts a form based on the GET parameters and a URL supplied to the script.
<?php
$url = $_GET["url"];
$args = explode("|", $_GET["args"]);
?>
<html>
<head>
<title>GET to POST</title>
</head>
<body onload="document.form.submit()">
<form name="form" action="<?php echo $url ?>" method="post">
@mondalaci
mondalaci / flash-embed-code-converter.html
Created March 30, 2014 02:38
Tool that escapes flash embed code to make it valid HTML. The escaped code is supposed to be unescaped on the client side.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Flash embed code converter</title>
</head>
<body>
<form action="">
Source Flash embed code:<br />
<textarea id="source" cols="80" rows="10"></textarea><br /><br />
@mondalaci
mondalaci / StringSet.js
Created April 24, 2014 16:02
StringSet class in JavaScript
"use strict";
var StringSet = /* StringSet */ function() {
this.set = {};
this.add = /* bool */ function(/* String */ string) {
var contains = this.contains(string);
this.set[string] = true;
return !contains;
};
@mondalaci
mondalaci / prototype
Created April 29, 2014 13:22
JavaScript prototype testing
function Project(basedOnJsObject) {
this.code = basedOnJsObject.code;
}
Project.prototype = {
getCode: function() {
return this.code;
}
}
@mondalaci
mondalaci / AngularDartNestedControllers.html
Created June 29, 2014 16:23
Angular Dart: Data binding doesn't work when manipulating the controller from the outside
<html ng-app>
<head>
<title>Angular.dart nested controllers</title>
</head>
<body>
<a href="#" id="open">open</a>
<div outer-controller ng-switch="outerCtrl.shouldShowInnerController">
<input type="checkbox" ng-model="outerCtrl.shouldShowInnerController">
<div inner-controller ng-switch-when="true">
Your name: <input ng-model="innerCtrl.yourName">
@mondalaci
mondalaci / refactoring-example.js
Created November 11, 2014 00:16
Refactoring example
// If separated storage data is available then extract it.
var hasStoredData = false;
if (project.userData.publishWebsite) {
var storedData = project.userData.publishWebsite;
if (storedData[locale]) {
hasStoredData = true;
scope.servingDomainPrefix = storedData[locale].servingDomainPrefix;
scope.servingDomainPostfix = storedData[locale].servingDomainPostfix;
}
}
@mondalaci
mondalaci / EmitXScancodePerSecond.c
Last active August 29, 2015 14:12
Emit the scancode of the "x" character per second
uint8_t isSecondElapsed = 0;
int main(void)
{
while (1) {
_delay_us(1000);
isSecondElapsed = 1;
}
}
@mondalaci
mondalaci / KeyMatrix.c
Last active August 29, 2015 14:12
Keyboard matrix scan code
/* A single pin of the microcontroller to which a row or column is connected. */
typedef struct {
volatile uint8_t *Direction;
volatile uint8_t *Name;
uint8_t Number;
} Pin_t;
/* This part of the key matrix is stored in the Flash to save SRAM space. */
typedef struct {
const uint8_t ColNum;
@mondalaci
mondalaci / uhk-animation.js
Created February 3, 2015 22:41
Ultimate Hacking Keyboard hand animation code
function animateHands(svgParam) {
'use strict';
var TYPING_DURATION = 1000;
var TYPING_REGION_X = 50;
var TYPING_REGION_Y = 20;
var HAND_SPEED_FACTOR = 2;
var HAND_MOVEMENT_INSIDE_DURATION = 150;
var HAND_MOVEMENT_OUTSIDE_DURATION = 500;
var HAND_FINGERS_POSITION_OFFSET_Y = 150;
@mondalaci
mondalaci / banshee.crash
Last active October 6, 2015 13:28
Banshee hangs
[Info 19:32:24.678] Running Banshee 2.4.0: [Ubuntu 12.04 LTS (linux-gnu, x86_64) @ 2012-05-06 11:52:27 UTC]
[Info 19:32:26.423] Updating web proxy from GConf
[Info 19:32:27.564] All services are started 2.412434
[Info 19:32:28.966] AmazonMP3 store redirect URL: http://redir.linuxmint.com/mp3amazonstore/
[Info 19:32:29.459] nereid Client Started
[Info 19:32:29.644] GStreamer version 0.10.36.0, gapless: True, replaygain: False
[Info 19:32:29.717] AppleDeviceSource is ignoring unmounted volume 80 GB LVM2 Physical Volume
(Banshee:12878): GLib-CRITICAL **: g_source_remove: assertion `tag > 0' failed
Exception in Gtk# callback delegate