jymden.com


  • Super simple navigation menu

    Here is a super simple navigation bar. Customize it for your site, with colors and fonts. This is just a super simple base recipe: First the html: [code language=”html”] <ul class="menubar"> <li><a href="#">hem</a></li> <li><a href="#">info</a></li> <li><a href="#">tjänster</a></li> <li><a href="#">kontakt</a></li> </ul> [/code]

  • (C#) Generate random readable passwords

    Here’s a super simple function that generates humanly readable passwords by weaving random consonants and wovels. The generated passwords are by no means secure. I did this for an application used to launch game servers and wanted to make the passwords be easy to communicate over Skype.

  • (C#) Swap two items in a generic list

    Put this in a static class. This will apply to Lists of any type. [c language=”language="#”] public static IList<T> Swap<T>(this IList<T> list, int indexA, int indexB) { if (indexB > -1 && indexB < list.Count) { T tmp = list[indexA]; list[indexA] = list[indexB]; list[indexB] = tmp; } return list; } [/c] Simply call it like…

  • (C#) Sort lists

    Lets say you have a list of person objects (List persons) You may use Sort to update the existing list. [c language=”#”] personsList.Sort((x, y) => string.Compare(x.Name, y.Name)); [/c] or OrderBy to produce a new, ordered list. [c language=”#”] var newPersonsList = persons.OrderBy(x => x.Name); [/c]

  • (PHP) Simple pagination

    Here’s a simple way to paginate when getting large amounts of posts from the database.

  • Generate dummy data

    Here’s a great tool for generating dummy data for your database etc. www.generatedata.com

  • (PHP) Simple gallery with thumbnail generation

    This is an enhanced version of this It’s a VERY simple php gallery. You could develop it in any direction. This one only supports jpg, but that could be augmented as well. Here’s what it does: Allows the user to choose an image and enter a title (or caption). Uploads the image to a folder…

  • Open weblinks in external browser when using Phonegap

    To prevent a Phonegap-wrapped app from opening external links in the apps webview, use javascript to open the link in the external browser. This works on Android (probably other platforms as well) [html]<a href="#" data-rel="external" target="_blank" onclick="window.open(‘http://www.jymden.com’, ‘_system’)">Jymden</a>[/html]

  • Convert seconds to days, hours, minutes and seconds

    Converting seconds into days, hours, minutes and seconds int days = secondsTotal / 60 / 60 / 24; int hours = (secondsTotal / 60 / 60) % 24; int minutes = (secondsTotal / 60) % 60; int seconds = secondsTotal % 60;

  • (C#) Confirmation when closing a form

    Add an event handler for Form Closing and use this code. This is a really simple solution. [c language=”#”] private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (MessageBox.Show("Are you sure?", "Close application", MessageBoxButtons.YesNo) == DialogResult.Yes) e.Cancel = false; else e.Cancel = true; } [/c]