Skip to content

Instantly share code, notes, and snippets.

View josuebasurto's full-sized avatar
😀
Happy

Josh B josuebasurto

😀
Happy
View GitHub Profile
@josuebasurto
josuebasurto / Restore Single User Database.sql
Created July 24, 2012 16:37
Restore a database first making the database single user then rollingback other users transactions, then restoring the backup.
/*
JB 20120724 - MS SQL SERVER 2008 R2
Restore a database first making the database single user then rollingback other users transactions, then restoring the backup.
Notes:
- This script is stored and shared as is.
- Might Work on other versions.
- Need owner privileges over database.
*/
@josuebasurto
josuebasurto / index.html
Created August 22, 2012 00:01 — forked from anonymous/index.html
Numbered Heading in HTML and CSS
<html>
<head></head>
<body>
<h1>My Article</h1>
<h2>Introduction</h2>
<h3>Rationale</h3>
<h2>Background</h2>
<h1>My Article</h1>
<h2>Introduction</h2>
<h2>Introduction</h2>
SELECT DB_NAME(dbid) AS DBName, hostname, program_name, cmd, nt_domain, nt_username, net_address, login_time, last_batch, net_library, loginame
FROM sys.sysprocesses
WHERE (DB_NAME(dbid) NOT IN ('master', 'tempdb', 'msdb'))
ORDER BY hostname
@josuebasurto
josuebasurto / ValentinesDay.js
Last active December 13, 2015 19:29 — forked from urish/gist:4958044
Thanks to Uri Shaked (https://gist.github.com/urish) Valentine's Day Message on Google - Open the attached file, copy all the text from it (or get it here) - Go to http://www.google.com/ in Google Chrome, press Ctrl+Shift+J (or on Mac ⌥⌘J). - Paste the text you copied in step 1 into the console Window
/* Copyright (C) 2013, Uri Shaked, GDG Tel-Aviv Lead. */
/*
- Open the attached file, copy all the text from it (or get it here)
- Go to http://www.google.com/ in Google Chrome, press Ctrl+Shift+J (or on Mac ⌥⌘J).
- Paste the text you copied in step 1 into the console Window
*/
var jq = document.createElement("script");
jq.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
@josuebasurto
josuebasurto / ChangeCollationQuery.sql
Last active December 13, 2015 20:28
Query that shows actual collation, changed collation and query for change column collation. Special Thanks to Betsy Alanis for this query.
/*
Query that shows actual collation, changed collation and query for change column collation.
Special Thanks to Betsy Alanis for this query.
*/
DECLARE @collation NVARCHAR(64)
SET @collation = 'Modern_Spanish_CI_AS'
SELECT COLLATION_NAME [Actual Collation], @collation [Destination Collation],
'ALTER TABLE [' + TABLE_SCHEMA + '].[' + TABLE_NAME + '] ' + 'ALTER COLUMN [' + COLUMN_NAME + '] ' + DATA_TYPE + '(' +
@josuebasurto
josuebasurto / Sugerencia.php
Created February 20, 2013 09:03
Consulta Generica en PHP
/* Copyright Josue Basurto 2013 | @josuebasurto | http://josuebasurto.com */
/* Este script tiene fallas no fue probado solo fue usado para demostracion de algoritmo de flexibilidad de campos y hace falta pruebas anti-SQLI */
$consulta_alumno = "SELECT * FROM tbl_alumno ";
define('K_WHERE', ' where ');
function busqueda_alumno(string campo, string filtros, )
{
if (campos='')
return $consulta_alumno;
@josuebasurto
josuebasurto / HTMLRedirection.html
Last active December 14, 2015 15:38
HTML redirect just in case you need to redirect one page to another
<!--
Copyright Josue bBasurto 2013 | @josuebasurto | http://josuebasurto.com
-->
<HTML>
<HEAD>
<!--
Redirect to any url in some time. Just replace:
* seconds: for the number of seconds you want the visitor to see this page
* the-other-url: for the new url you want to redirect the client
-->
@josuebasurto
josuebasurto / INIHelper.cs
Last active August 14, 2018 02:13
Class to save and read from a INI File
/* Copyright Josue Basurto 2013 | @josuebasurto | http://josuebasurto.com */
using System.Runtime.InteropServices;
using System.Text;
namespace customnamespace
{
internal class INIHelper
{
#region Variables y constantes
@josuebasurto
josuebasurto / Link Twitter Hashtag.html
Created September 27, 2013 01:28
Codigo para generar un boton de twitter haciendo link con el hashtag, para propuesta de Platzi de Mejorando.la
@josuebasurto
josuebasurto / GetResources.cs
Created October 22, 2013 19:40
Get Resources Text
public string GetResourceText(string resourcekey)
{
object resourceText = null;
if (this.ResourceFilePathExist || this.ResourceFilePathDefaultExist)
{
resourceText = this.GetLocalResourceObject(resourcekey);
if (resourceText != null)
{
return resourceText.ToString();