Skip to content

Instantly share code, notes, and snippets.

View anytizer's full-sized avatar

Bimal Poudel anytizer

View GitHub Profile
@anytizer
anytizer / DataDTO-Combobox.cs
Last active February 9, 2018 20:19
Custom drop-down combo box in C#
public class DataDTO
{
public string id { get; set; }
public string name { get; set; }
}
@anytizer
anytizer / mapping.cs
Last active December 31, 2017 15:11
Auto Mapper
Mapper.Initialize(cfg => {
cfg.CreateMap<account_roles, RoleDTO>()
.ForMember(x => x.id, opt => opt.MapFrom(x => x.role_id))
.ForMember(x => x.name, opt => opt.MapFrom(x => x.role_name))
;
cfg.CreateMap<account_users, UserDTO>()
.ForMember(x => x.id, opt => opt.MapFrom(x => x.user_id))
.ForMember(x => x.email, opt => opt.MapFrom(x => x.user_email))
;
@anytizer
anytizer / 01-data-grid-view.cs
Last active February 2, 2019 02:47
Data Grid View default controls
dataGridView1.AllowDrop = false;
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.AllowUserToOrderColumns = false;
dataGridView1.AllowUserToResizeColumns = false;
dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
dataGridView1.AutoGenerateColumns = true; // change this
dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
dataGridView1.BackgroundColor = Color.Honeydew;
dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.Yellow;
@anytizer
anytizer / Zoom CSS
Created December 17, 2017 09:50
zoom.css
/**
* If a difference is detected, force to zoom
*/
.zoomX{
zoom: 150%;
-moz-transform: scale(1.5);
}
@anytizer
anytizer / $http
Last active December 14, 2017 16:35
Angular $http
$http({
method: "POST",
url: "api/files.php"
}).then(function(response) {
$scope.files = response.data;
}, function(response) {
// error
});
@anytizer
anytizer / run.cs
Created August 17, 2017 19:08
File system watcher
using api.general;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace console
{
class run
@anytizer
anytizer / opensearch.html
Created August 17, 2017 15:49
Adds a custom search in Firefox
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Example Search">
Look for Example Search!
@anytizer
anytizer / mysql-json.cs
Created August 30, 2016 06:28
MySQL to JSON in C#
using MySql.Data.MySqlClient;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
@anytizer
anytizer / backup-all-databases.sh
Created July 10, 2016 16:59
Backup all databases at once with one shell script.
#!/bin/bash
# Backup all available databases
USERNAME="root";
PASSWORD="password";
for DATABASE in `mysql -u${USERNAME} -p${PASSWORD} -e "SHOW DATABASES;"`
do
echo mysqldump --routines -u${USERNAME} -p${PASSWORD} ${DATABASE} \> ${DATABASE}.dmp;
mysqldump --routines -u${USERNAME} -p${PASSWORD} ${DATABASE} > ${DATABASE}.dmp;
@anytizer
anytizer / lampp-alias.sh
Created May 27, 2016 19:42
After installing XAMPP on Linux Platforms; run these scripts to access mysql, mysqldump and php
#!/bin/bash
ln -s /opt/lampp/bin/mysql /usr/local/bin/mysql
ln -s /opt/lampp/bin/mysqldump /usr/local/bin/mysqldump
ln -s /opt/lampp/bin/php /usr/local/bin/php
ln -s /opt/lampp/lampp /usr/local/bin/lampp