Skip to content

Instantly share code, notes, and snippets.

View dreamstarter's full-sized avatar
💭
Building a new application!

Bryan Anderson dreamstarter

💭
Building a new application!
View GitHub Profile
@dreamstarter
dreamstarter / Javascript - Simple email validation
Last active March 27, 2024 16:24
Javascript - Use a regex to check the email address input.
function checkEmail(email) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if (!reg.test(email)) return false;
return true;
}
@dreamstarter
dreamstarter / Coldfusion - simple login script
Last active September 25, 2018 15:09
Simple login script
<cfif session.login_required EQ "Y">
<cfif NOT findnocase('login.cfm',CGI.SCRIPT_NAME) AND session.loggedin EQ "n">
<cfscript>
structDelete(session, 'user');
structDelete(session, 'admin');
</cfscript>
<cflocation url="#this.site_root#/login.cfm" addtoken="no">
</cfif>
<cfif checklogin EQ "y">
<!--- invoke the users controller and check the form data submitted from the login form --->
@dreamstarter
dreamstarter / app.rake
Created September 25, 2018 15:12 — forked from ChuckJHardy/app.rake
Rake Task for Database Population
------------ From Rake Task
namespace :app do
# Checks and ensures task is not run in production.
task :ensure_development_environment => :environment do
if Rails.env.production?
raise "\nI'm sorry, I can't do that.\n(You're asking me to drop your production database.)"
end
end
@dreamstarter
dreamstarter / bar.rake
Created September 27, 2018 12:57
Testing rake tasks
File: lib/tasks/bar.rake
class BarOutput
def self.banner text
puts '*' * 60
puts " #{text}"
puts '*' * 60
end
def self.puts string
puts string
@dreamstarter
dreamstarter / Rakefile
Created September 27, 2018 13:02 — forked from brettchalupa/Rakefile
Testing Rake tasks with RSpec examples from the talk I gave at Test Ruby PDX in March 2016. See more here: http://bit.ly/testing-rake-tasks
require_relative 'greeter'
desc 'Outputs a greeting to stdout'
task :hello do
Greeter.new.greet
end
@dreamstarter
dreamstarter / .gitconfig
Created February 28, 2019 18:26 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
#!/bin/python
import sys
import os
# Complete the function below.
### start of my code ###
def doesCircleExists(commands):
@dreamstarter
dreamstarter / fileupload.php
Created April 4, 2019 14:04
php file upload form
<!DOCTYPE html>
<html>
<head>
<title>File Upload</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
<input type="file" name="csv_file">
<input type="submit" name="submit">
@dreamstarter
dreamstarter / .gitignore
Created April 4, 2019 19:00 — forked from salcode/.gitignore
.gitignore file for a general web project - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20181206
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/10017553/raw/.gitignore
# to download this file
#
[link to jira ticket]
Description of change
Please provide a description of the change here. Include links where the change can be viewed, and how the reviewer should proceed with manual testing, or inspecting visual changes.
Checklist
[ ] I have performed a self-review of my own code
[ ] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[ ] My changes generate no new warnings or errors.