Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

public enum WdtOscillatorCycles
{
_16k = 0x00,
_32k,
_64k,
_128k,
_256k,
_512k,
_1024k,
_2048k
@iskernel
iskernel / CSharp_Winforms_MappingEnumsToComboboxes_TypeConverter.cs
Created May 8, 2013 11:17
TypeConverter for mapping enums to comboboxes in C#.
public class EnumToStringUsingDescription : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context,
Type sourceType)
{
return (sourceType.Equals(typeof(Enum)));
}
public override bool CanConvertTo(ITypeDescriptorContext context,
Type destinationType)
[TypeConverter(typeof(EnumToStringUsingDescription))]
public enum WdtOscillatorCyclesImproved
{
[Description("16000 Cycles")]
_16k = 0x00,
[Description("32000 Cycles")]
_32k,
[Description("64000 Cycles")]
_64k,
[Description("128000 Cycles")]
@iskernel
iskernel / CSharp_Winforms_MappingEnumsToComboboxes_ActualMapping.cs
Last active December 17, 2015 02:59
How to map enums to comboboxes in C#.
public partial class MappingEnumToComboboxesForm : Form
{
public MappingEnumToComboboxesForm()
{
InitializeComponent();
//Setting the enums as the data sources of the comboboxes
comboBoxNormal.DataSource =
Enum.GetValues(typeof(WdtOscillatorCycles));
comboBoxImproved.DataSource =
Enum.GetValues(typeof(WdtOscillatorCyclesImproved));
public class AdcAdapter
{
private IAdcModel _model;
private IAdcView _view;
public AdcAdapter(IAdcView view, IAdcModel model)
{
_model = model;
_view = view;
}
@iskernel
iskernel / Ruby_WebScrapping_FontAwesomeCheatSheet.rb
Last active December 18, 2015 10:39
A simple script for extracting the unicodes and the icon names from the Font Awesome cheat-sheet page.
require 'net/http'
#Reads the HTML page
fontAwesomeUri = URI('http://fortawesome.github.io/Font-Awesome/cheatsheet/')
htmlSourceArray = Net::HTTP.get(fontAwesomeUri).split(/\r?\n/)
outputArray = Array.new()
tempString = String.new()
#Extracts the lines containing the unicodes and the icon names
htmlSourceArray.each_with_index do |line,index|
line = line.strip
@iskernel
iskernel / Html_About_AwesomeImage.html
Last active December 19, 2015 10:28
HTML example for an about page.
<!DOCTYPE HTML>
<html>
<head>
<title>About</title>
<!--Include Twitter Boostrap CSS-->
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css"
rel="stylesheet"
type="text/css"/>
<!--Include JQuery-->
<script type="text/javascript"
@iskernel
iskernel / Dart_HtmlTablesorter_HowToUse.dart
Created July 6, 2013 17:20
The Dart code for using the HTML Tablesorter package.
import "dart:html";
import "package:iskernel_html_tablesorter/html_tablesorter.dart";
void main()
{
TableSorter sorter = new TableSorter("#sortableTable");
sorter.enableSorting(true);
}
@iskernel
iskernel / Html_TableSorter_HowTo.html
Last active December 19, 2015 10:29
The HTML code for the HTML Table Sorter example.
<!DOCTYPE html>
<html>
<head>
<title>example</title>
</head>
<body>
<table border="1" id="sortableTable">
<thead>
@iskernel
iskernel / Notebook_PowerShell_FixCorruptDirectory.ps1
Created July 13, 2013 00:25
How to fix a corrupt directory using ChkDsk.
<#
When you attempt to open, delete or rename a file or folder using Windows NT
Explorer, File Manager or a command prompt, you may receive one of the
following error messages:
<drive>:\<folder> is not accessible
The file or directory is corrupt and non-readable.
The file or directory is corrupt and non-readable.
The file or directory \<folder> is corrupt and unreadable.
#>
#The drive you want to check