Skip to content

Instantly share code, notes, and snippets.

View marcelodeandrade's full-sized avatar

Marcelo de Andrade marcelodeandrade

View GitHub Profile
@mlhaufe
mlhaufe / parameters.vbs
Created June 19, 2011 12:52
VBScript class constructor parameters
Class Person
Private m_Age
Private m_Name
Public Default Function Init(Name, Age)
m_Name = Name
m_Age = Age
Set Init = Me
End Function
@gwobcke
gwobcke / checkIfInArray.asp
Last active October 4, 2022 12:42
Classic ASP Check If In Array
<%
Function in_array(element, arr, performTrim)
Dim i
in_array = False
For i=0 To Ubound(arr)
If performTrim Then '//there are some scenarios where you want to trim
If Trim(arr(i)) = Trim(element) Then
in_array = True
Exit Function
End If
@bdcravens
bdcravens / add-timestamps.sql
Created December 19, 2012 21:32
SQL Server - add createdAt and updatedAt columns, automatically updates
ALTER TABLE myTable
add createdAt datetime
CONSTRAINT DF_myTable_createdat DEFAULT GETDATE()
ALTER TABLE myTable
add updatedAt datetime
CONSTRAINT DF_myTable_updatedAt DEFAULT GETDATE()
go
@DinoChiesa
DinoChiesa / sql-1.asp
Created May 21, 2013 04:40
An example of a Classic ASP module implemented in JavaScript. This one reads from a SQL database, does content negotiation, returning a query result as Text, XML, JSON, or HTML.
<%@ language="Javascript" %>
<script language="javascript" runat="server" src='json2.js'></script>
<script language="javascript" runat="server" src='stringExtensions.js'></script>
<script language="javascript" runat="server" src='contentNego.js'></script>
<script language="javascript" runat="server">
(function() {
// In an ASP scenario, this fn gets "exported"
@nanotaboada
nanotaboada / books.json
Last active December 9, 2023 12:24
A small-sized (8 items) sample collection of free Books in valid JSON (RFC 8259) format
{
"books":[
{
"isbn":"9781593279509",
"title":"Eloquent JavaScript, Third Edition",
"subtitle":"A Modern Introduction to Programming",
"author":"Marijn Haverbeke",
"published":"2018-12-04T00:00:00.000Z",
"publisher":"No Starch Press",
"pages":472,
@CarlRevell
CarlRevell / class_logger.asp
Last active November 4, 2022 07:56
Simple classic ASP log to file class.
<%
'// Usage:
'//
'// dim l : set l = new logger
'// l.log("Hello")("World")
'// l.includeTimetamp = false
'// l("Lorem ipsum")
'// l.setLogFile("c:\temp\log_2.log").log("This is a new log!")
'// set l = nothing
@markmarkoh
markmarkoh / README.md
Last active June 10, 2018 08:51
Custom Map Data in Datamaps
@CrookedNumber
CrookedNumber / gist:8964442
Created February 12, 2014 21:02
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@stefansundin
stefansundin / install-pre-commit.sh
Last active September 17, 2023 11:46
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding: