Skip to content

Instantly share code, notes, and snippets.

View rurtubia's full-sized avatar

Randy Urtubia rurtubia

View GitHub Profile
@rurtubia
rurtubia / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rurtubia
rurtubia / HelloWorld.cs
Last active August 29, 2015 14:19
Simple Hello World C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorld
{
class Program
{
@rurtubia
rurtubia / BSOD.cs
Last active August 29, 2015 14:19
BSOD Imitation, uses the Console Methods (BackgroundColor, ForegroundColor, Clear, WriteLine, ReadLine) ---- Imitación de Blue Screen of Death ('pantallazo azul') usando métodos de Console.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorld
{
class Program
{
@rurtubia
rurtubia / PrintForLoop.jsp
Created April 24, 2015 17:22
Using JSP, runs simple java code on HTML. The browser just sees the HTML equivalent of the text. uses: * java for loop * HTML * JSP scriplets - Comment <%-- --%> - Declaration <% %> - Printing <%= %> * Adds no-cache snippet to avoid caching of code. Coded in Netbeans IDE 8.0.2 Run on Glassfish Server
<%--
Document : index
Created on : Apr 22, 2015, 12:58:57 PM
Author : rurtubiac
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
@rurtubia
rurtubia / InsertConnection.cs
Created April 24, 2015 17:42
Captures text from textboxes in a Windows Form. Creates a conection to an SQL Server database. Inserts the captured information into the database.
//Creates connection
//@"Server=[local computer]"
//Integrated Security=yes, means Windows Authentication
//Database=[database name]"
SqlConnection miConexion = new SqlConnection(
@"Server=AE-PC\SQLEXPRESS;
Integrated Security=yes;
Database=clientes");
@rurtubia
rurtubia / auto_increment.sql
Last active August 29, 2015 14:19
Shows the syntax and comments on how to create tables whose IDs increment with each new record inserted. Code taken from: http://www.w3schools.com/sql/sql_autoincrement.asp
--Syntax for MySQL:
--Keyword: AUTO_INCREMENT
CREATE TABLE Persons
(
ID INT NOT NULL AUTO_INCREMENT,
LastName VARCHAR(255) NOT NULL,
FirstName VARCHAR(255),
Address VARCHAR(255),
City VARCHAR(255),
@rurtubia
rurtubia / Basic_iTextSharp.cs
Last active August 29, 2015 14:19
Using the iTextSharp library creates a simple PDF file from information from textboxes.
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
private void printButton_Click(object sender, EventArgs e)
{
Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 10, 10);
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream("report.pdf", FileMode.Create));
doc.Open(); //opens document to write
@rurtubia
rurtubia / select.sql
Created April 24, 2015 17:53
SQL SELECT, DISTINCT, WHERE. Operators: AND, OR, ORDER BY. Taken from http://www.w3schools.com/sql/sql_select.asp
--The SELECT statement is used to select data from a database.
--SQL SELECT Syntax:
SELECT column_name,column_name
FROM table_name;
--or:
SELECT * FROM table_name;
@rurtubia
rurtubia / FigurasGeometricas.jsp
Last active August 29, 2015 14:19
Formulario de cálculo Figuras Geométricas. Uses HTML and Java to calculate the area of rectangles and circles whose data (base, height, radius) have been submitted through a form. Uses Javascript to draw shapes on a Canvas.
<%--
Document : index
Created on : Apr 23, 2015, 5:08:04 PM
Author : rurtubiac
--%>
<%@page import="figurasgeometricas.entities.Circle"%>
<%@page import="figurasgeometricas.entities.Rectangle"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
@rurtubia
rurtubia / CloseJavaFile.java
Last active August 29, 2015 14:19
Closes a java File from a Menu Item
private void jMenuItemExitActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}