Skip to content

Instantly share code, notes, and snippets.

View IamSilviu's full-sized avatar
🎯
Focusing

Silviu Durduc IamSilviu

🎯
Focusing
View GitHub Profile
@IamSilviu
IamSilviu / gist:9887405
Created March 31, 2014 08:00
C# Save and Load Image from Database
private void btnLoad_Click(object sender, RoutedEventArgs e)
{
// Display select file dialog
OpenFileDialog op = new OpenFileDialog();
op.Title = "Select a picture";
op.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
"JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
"Portable Network Graphic (*.png)|*.png";
if (op.ShowDialog() == true)
{
@IamSilviu
IamSilviu / SenchaTouch2 Internet Explorer visual fix
Last active April 13, 2016 10:34
CSS Sencha Touch 2.3.1 IE: 10, 11 Fieldset and Input visual fix
/* Remove the IE default clear button and password reveal button */
*::-ms-clear, *::-ms-reveal {
display: none;
}
/* Fix fieldsets and icons with align top */
/* Sebastian Tomescu */
.x-ie .x-dock-vertical.x-stretched > .x-dock-body,
.x-ie .x-iconalign-top.x-button{
height: auto !important;
@IamSilviu
IamSilviu / validateEmail
Created September 16, 2013 08:05
JavaScript isEmail
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
@IamSilviu
IamSilviu / Time Overlapping validation
Created July 1, 2013 09:01
JavaScript Validation for time overlapping.Returns true if time overlaps, requires a param with start - end time stamp.
var Timestamps = [
{ start: 1360454400000, end: 1360540800000 },
{ start: 1360454400000, end: 1360574700000 },
{ start: 1372668447947, end: 1372668447947 }]
var timeOverlaps = function (Timestamps) {
for (var i = 0; i < Timestamps.length; i++) {
for (var j = i + 1; j < Timestamps.length; j++) {
@IamSilviu
IamSilviu / Get week number
Last active January 24, 2022 08:40
JavaScript Get week number.
Date.prototype.getWeek = function () {
var onejan = new Date(this.getFullYear(), 0, 1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7);
};
var myDate = new Date("2001-02-02");
myDate.getWeek(); //=> 5