Skip to content

Instantly share code, notes, and snippets.

View chinhvo's full-sized avatar

Chinh Vo chinhvo

  • Ho Chi Minh City
View GitHub Profile
@robban
robban / gist:328191
Created March 10, 2010 18:44
Easily add a google map location picker to your form
<!--
Use this snippet to add a google map location chooser to your form
Step 1: Get a google map api key and insert it in the first javascript tag
Step 2: In your html form, create two hidden elements, one for latitude, and one for longitude. Give the elements ids and set the LATITUDE_ELEMENT_ID and LONGITUDE_ELEMENT_ID to the appropriate variables
Done!
-->
@huobazi
huobazi / CRUD_SP_Generation.sql
Created June 2, 2011 04:40 — forked from adamcarr/CRUD_SP_Generation.sql
Generate CRUD stored procedures from tables in schema
-- #########################################################
-- Author: www.sqlbook.com
-- Copyright: (c) www.sqlbook.com. You are free to use and redistribute
-- this script as long as this comments section with the
-- author and copyright details are not altered.
-- Purpose: For a specified user defined table (or all user defined
-- tables) in the database this script generates 4 Stored
-- Procedure definitions with different Procedure name
-- suffixes:
-- 1) List all records in the table (suffix of _GetAll)
@adhipg
adhipg / countries.sql
Last active August 31, 2026 17:24
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@jstangroome
jstangroome / Import-VSSRepository.ps1
Created June 13, 2012 06:01
PowerShell script to perform a simple check-in of a Visual SourceSafe project's latest files to Team Foundation Server
[CmdletBinding()]
param (
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[ValidatePattern('^(\\\\|[a-z]\:)')] # \\share or drive:
[string]
$VssRepositoryPath,
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[ValidatePattern('^\$/')] # $/something
[string]
@nxax
nxax / MySQLiteOpenHelper
Created August 5, 2012 18:56
Check table if exists on SQLite
// Check table if exists on SQLite
// http://stackoverflow.com/questions/3058909/how-does-one-check-if-a-table-exists-in-an-android-sqlite-database
//
public boolean isTableExists(String tableName, boolean openDb) {
if(openDb) {
if(mDatabase == null || !mDatabase.isOpen()) {
mDatabase = getReadableDatabase();
}
if(!mDatabase.isReadOnly()) {
@tomorgan
tomorgan / UCMA UserEndpoint Sending IM Example.cs
Created March 4, 2013 17:14
Simplest example using UCMA UserEndpoint to send an IM. Note: no error handling, assumes IM always accepted etc. For learning only :)
using Microsoft.Rtc.Collaboration;
using System;
namespace SimpleUserUCMA
{
class Program
{
private const string sipaddress = "sip:from@domain.com";
private const string username = "USERNAME";
private const string password = "PASSWORD";
@lukas-vlcek
lukas-vlcek / gist:5143799
Last active February 7, 2023 21:50
Adding a new analyzer into existing index in Elasticsearch (requires close/open the index). Tested with Elasticsearch 0.19.12.
// create an index with an analyzer "myindex"
curl -X PUT localhost:9200/myindex -d '
{
"settings" : {`
"index":{
"number_of_replicas":0,
"number_of_shards":1,
"analysis":{
"analyzer":{
"first":{
@GeorgeDellinger
GeorgeDellinger / sp_generate_inserts.sql
Last active October 21, 2019 10:13
My copy of sp_generate_inserts scripts..... Only changes: Commented out the calls to sp_MS_upd_sysobj_category.Added sp_MS_marksystemobject to end of script.
SET NOCOUNT ON
GO
PRINT 'Using Master database'
USE master
GO
PRINT 'Checking for the existence of this procedure'
IF (SELECT OBJECT_ID('dbo.sp_generate_inserts','P')) IS NOT NULL --means, the procedure already exists
BEGIN
@afreeland
afreeland / gist:6730973
Last active May 30, 2020 12:16
C#: Create an Expression to use with LINQ
public ActionResult Grid(string FirstName, string LastName)
{
GridHelper.Filters filter = new GridHelper.Filters("FirstName", "LastName");
var _page =(!String.IsNullOrEmpty(HttpContext.Request.QueryString["page"])) ? Convert.ToInt32(HttpContext.Request.QueryString["page"]) : 1;
var _contacts = from c in testDB.Contacts
join ac in testDB.Account_Contact on c.ID equals ac.ContactID
where ac.AccountID == 725
select c;
@richardszalay
richardszalay / XframeOptionsAttribute.cs
Last active February 25, 2020 11:39
ASP.NET MVC action filter for specifying an X-FRAME-OPTIONS header
/*
Copyright (C) 2013 Richard Szalay
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR