Skip to content

Instantly share code, notes, and snippets.

@PyramisDev
PyramisDev / Encryption_Decryption.vbs
Last active January 28, 2019 02:41
You can use this code to encrypt and decrypt a stored values. You can also set you own encryption key that will be stored in a String(EncryptionKey) http://www.pcreview.co.uk/forums/encrypt-my-settings-setting-t2642486.html
Imports System.Security.Cryptography
Imports System.Text
Module mod_Globals
Public EncryptionKey As String = "justsomewordstobeusedasacryptionkey"
Public Function EncryptString128Bit(ByVal vstrTextToBeEncrypted As
String, ByVal vstrEncryptionKey As String) As String
@PyramisDev
PyramisDev / File Deletion.vbs
Created July 30, 2013 14:11
Deleting files using the delete method of System.IO
Dim FileToDelete As String
FileToDelete = "file to delete"
If System.IO.File.Exists( FileToDelete ) = True Then
System.IO.File.Delete( FileToDelete )
MsgBox("File Deleted")
End If
@PyramisDev
PyramisDev / Textbox Select All.vbs
Created July 30, 2013 14:13
Let the user press Ctrl-A to select all of the text in a TextBox in VB .NET When the TextBox's KeyPress event sees the Ctrl-A key code (1), it casts the event's sender into a TextBox and calls the TextBox's SelectAll method. The code then sets e.Handled to True to indicate that the character has been handled. This prevents the TextBox from beeping.
If e.KeyChar = Convert.ToChar(1) Then
DirectCast(sender, TextBox).SelectAll()
e.Handled = True
End If
@PyramisDev
PyramisDev / HTTP File Transfer.vbs
Created July 30, 2013 14:23
Transfers files using HTTP
'Does not have to be hardcoded like below, can be pulled from a text box or something
Dim strPostURL = "http://www.google.com"
AddText("URL TO POST: " + strPostURL)
Dim requestStream As Stream = Nothing
Dim fileStream As FileStream = Nothing
Dim uploadResponse As Net.HttpWebResponse = Nothing
Try
@PyramisDev
PyramisDev / Counter.js
Created August 2, 2013 04:21
Simple javascript counter. The .getElementById("id") refers to the css id of the target element.
function init() {
var n = 0;
e = document.getElementById("output");
setInterval(function() { e.innerHTML = ++n; }, 1000);
}
window.onload = init;
@PyramisDev
PyramisDev / Scrollbar stlying.css
Created September 14, 2013 13:38
Webkit's support for scrollbars is quite sophisticated. This CSS gives a very minimal scrollbar, with a light grey track and a darker thumb: RGBA color values are supported in IE9+, Firefox 3+, Chrome, Safari, and in Opera 10+. RGBA color values are an extension of RGB color values with an alpha channel - which specifies the opacity of the objec…
::-webkit-scrollbar
{
width: 12px; /* for vertical scrollbars */
height: 12px; /* for horizontal scrollbars */
}
::-webkit-scrollbar-track
{
background: rgba(0, 0, 0, 0.1);
}
@PyramisDev
PyramisDev / Country name and flag in php.php
Created September 25, 2013 05:44
Country name and flag in php
Get Country
-----------
<?php
$country = file_get_contents('http://api.hostip.info/country.php?ip='.$_SERVER['REMOTE_ADDR']);
echo $country; //Remove this line
?>
@PyramisDev
PyramisDev / ranStrGen.php
Created October 2, 2013 23:32
85 character string generator
<?php
function haha()
{
$a = uniqid();
$b = sha1(uniqid());
$c = md5(uniqid());
$d = $a . $b . $c;
return $d;
}
echo haha();
@PyramisDev
PyramisDev / Telephone Regular Expression
Created October 3, 2013 12:47
The following regex attempts to match numbers that adhere to the North American Numbering Plan. It matches common entry combinations, such as #######, ###.###.####, ###-###-####, ### ### ####, and (###) ### ####. http://www.gigoblog.com/2008/11/28/regex-preg_match-for-zip-codes-phone-numbers-states-urls-and-email-addresses/
/\(?[2-9][0-8][0-9]\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}/
@PyramisDev
PyramisDev / FileDownload.js
Created October 7, 2013 15:36
File downloader script, can be called on onclick events for any DOM element.
<script type="text/javascript">
function functionName() {
var url = "pathToFileToDownload.extention";
window.open(url, 'Download');}
</script>