Skip to content

Instantly share code, notes, and snippets.

View malkitsingh's full-sized avatar
🎯
Focusing

Malkit Singh malkitsingh

🎯
Focusing
View GitHub Profile
@malkitsingh
malkitsingh / index.html
Created December 5, 2016 06:18
Connecting/Testing socket
<html>
<head>
<title>
Socket Testing
</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.6.0/socket.io.min.js"></script>
<script type="text/javascript">
@malkitsingh
malkitsingh / Setting mongo db as a service.txt
Created November 30, 2016 14:46
Running Mondo DB as a Service
Make sure that you added you /bin directory to you system variable PATH
D:\mongodb\bin>mongod --remove
First I executed this command after opening command prompt as administrator:
D:\mongodb\bin>mongod --dbpath=D:\mongodb --logpath=D:\mongodb\log.txt --install
After that right there in the command prompt execute:
services.msc
@malkitsingh
malkitsingh / countries.json
Created October 21, 2016 09:45
Countries JSON
{"results":[{"id":"1","iso":"AF","name":"AFGHANISTAN","nicename":"Afghanistan","iso3":"AFG","numcode":"4","phonecode":"93"},{"id":"2","iso":"AL","name":"ALBANIA","nicename":"Albania","iso3":"ALB","numcode":"8","phonecode":"355"},{"id":"3","iso":"DZ","name":"ALGERIA","nicename":"Algeria","iso3":"DZA","numcode":"12","phonecode":"213"},{"id":"4","iso":"AS","name":"AMERICAN SAMOA","nicename":"American Samoa","iso3":"ASM","numcode":"16","phonecode":"1684"},{"id":"5","iso":"AD","name":"ANDORRA","nicename":"Andorra","iso3":"AND","numcode":"20","phonecode":"376"},{"id":"6","iso":"AO","name":"ANGOLA","nicename":"Angola","iso3":"AGO","numcode":"24","phonecode":"244"},{"id":"7","iso":"AI","name":"ANGUILLA","nicename":"Anguilla","iso3":"AIA","numcode":"660","phonecode":"1264"},{"id":"8","iso":"AQ","name":"ANTARCTICA","nicename":"Antarctica","iso3":null,"numcode":null,"phonecode":"0"},{"id":"9","iso":"AG","name":"ANTIGUA AND BARBUDA","nicename":"Antigua and Barbuda","iso3":"ATG","numcode":"28","phonecode":"1268"},{"id":"1
@malkitsingh
malkitsingh / hook.js
Created October 3, 2016 07:01
Gist for setting up webhook to pull from rep and run rebuild commands for us
/* Create a webhook in your GIT repo and put your IP-ADDRESS:1340
* select content-type : application/json
* do a npm install github-webhook-handler
* to start the server - node hook.js
*
*/
var http= require("http");
var exec = require('child_process').exec;
Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
catch (DbEntityValidationException ex)
{
foreach (var validationErrors in ex.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
CREATE FUNCTION [dbo].[UNIX_TIMESTAMP] (
@ctimestamp datetime
)
RETURNS integer
AS
BEGIN
/* Function body */
declare @return integer
SELECT @return = DATEDIFF(SECOND,{d '1970-01-01'}, @ctimestamp)
UPDATE dbo.timezone SET dbo.timezone.[Column 4] = REPLACE( dbo.timezone.[Column 4], RIGHT(dbo.timezone.[Column 4], 1), '' )
SELECT SUSER_NAME()
create schema dbo authorization appointmenthouseUser;
create schema my_schema_name authorization my_user;
alter user appointmenthouseUser with default_schema= dbo;
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
public String ConvertImageURLToBase64(String url)
{
StringBuilder _sb = new StringBuilder();
Byte[] _byte = this.GetImage(url);
_sb.Append(Convert.ToBase64String(_byte, 0, _byte.Length));
return _sb.ToString();
}