Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View chrisdiana's full-sized avatar

Chris Diana chrisdiana

View GitHub Profile
@chrisdiana
chrisdiana / gist:f0777eb35a5adece8422
Last active November 2, 2017 16:20
Reset GIT to commit force push
# Local reset:
git reset --hard fj5789sufj
# Remote reset:
git push -f origin fj5789sufj:master
@chrisdiana
chrisdiana / jquertips.md
Created October 22, 2015 16:45
jQuery Tips
@chrisdiana
chrisdiana / funterm.txt
Created August 11, 2015 18:19
Fun with Terminal
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██
█▌ - FUN ON THE TERMINAL - █▌
█▌ PUBLIC TELNET ASCII ART, GAMES, ETC (ALL OSes) █▌
█ ▐▌
█ ▐▌
█ Connect to other servers through telnet to view their animated ASCII art, ▐▌
█ games, etc they offer the public. If no port is specified than it is the ▐▌
█ default port 23; you don't need to specify it. ▐▌
█ ▐▌
@chrisdiana
chrisdiana / cars.json
Created July 28, 2015 05:43
JSON Array of all cars makes and models (71 makes and over 1,300 different models)
[{"value":"ACURA","title":"Acura","models":[{"value":"CL_MODELS","title":"CL Models (4)"},{"value":"2.2CL","title":" - 2.2CL"},{"value":"2.3CL","title":" - 2.3CL"},{"value":"3.0CL","title":" - 3.0CL"},{"value":"3.2CL","title":" - 3.2CL"},{"value":"ILX","title":"ILX"},{"value":"INTEG","title":"Integra"},{"value":"LEGEND","title":"Legend"},{"value":"MDX","title":"MDX"},{"value":"NSX","title":"NSX"},{"value":"RDX","title":"RDX"},{"value":"RL_MODELS","title":"RL Models (2)"},{"value":"3.5RL","title":" - 3.5 RL"},{"value":"RL","title":" - RL"},{"value":"RSX","title":"RSX"},{"value":"SLX","title":"SLX"},{"value":"TL_MODELS","title":"TL Models (3)"},{"value":"2.5TL","title":" - 2.5TL"},{"value":"3.2TL","title":" - 3.2TL"},{"value":"TL","title":" - TL"},{"value":"TSX","title":"TSX"},{"value":"VIGOR","title":"Vigor"},{"value":"ZDX","title":"ZDX"},{"value":"ACUOTH","title":"Other Acura Models"}]},{"value":"ALFA","title":"Alfa Romeo","models":[{"value":"ALFA164","title":"164"},{"value":"ALFA8C","title":"8C Competizione"
@chrisdiana
chrisdiana / gist:ac64daf20d405b33d7a6
Last active September 10, 2021 12:24
PHP Login without Database
<?php
session_start();
// ***************************************** //
// ********** DECLARE VARIABLES ********** //
// ***************************************** //
$username = 'username';
$password = 'password';
@chrisdiana
chrisdiana / gist:8d7985e9b06dfbb792a8
Last active October 4, 2022 22:08
Detect field change in ExtJS
var panel = new Ext.form.FormPanel({
title: 'Example',
width: 350,
items: [],
listeners: {
add: function(me, component, index) {
component.on('change', function(f,n,o) {
alert('detected! '+f.label+' value changed from '+o+' to '+n);
console.log(component.startValue);
});
@chrisdiana
chrisdiana / gist:c1b4a070454fdacaab9e
Last active August 29, 2015 14:14
Hide App Icon from Dock in OS X
# Locate the 'Info.plist' by right clicking app and 'Show Package Contents'
# Add this just before the closing of the `</dict>` tag near where you see
# something similar to `<string>MainMenu</string><key>NSPrincipalClass</key>`
<key>LSUIElement</key>
<true/>
@chrisdiana
chrisdiana / convert_hex_xterm.py
Created January 29, 2015 23:23
Convert hex color code to closest xterm-256 value
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@chrisdiana
chrisdiana / new_gist_file.html
Created November 11, 2014 06:35
The Best IE Warning
<!--[if lte IE 6]>
<div style="background-color:#FFFFCC;padding:15px;border:solid 1px #000000;margin-bottom:20px;">
<h1 style="color:#000000;margin-bottom:10px;">Warning - Unsupported Browser</h1>
<p>You are using an outdated version of Internet Explorer that has security issues and does not support global web standards. To ensure you have a better user experience online, across all sites (that includes capitolsales.com), we recommend that you upgrade <a class="getie7" href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx" target="_blank">your version of Internet Explorer</a> or choose any of these <strong>other excellent browsers</strong>: <a href="http://www.opera.com/download/" target="_blank">Opera</a>, <a href="http://www.mozilla.com/firefox/" target="_blank">Firefox</a>, <a href="http://www.apple.com/safari/download/" target="_blank">Safari</a> or <a href="http://www.google.com/chrome" target="_blank">Chrome</a>. It's free!</p>
</div>
<![endif]-->
@chrisdiana
chrisdiana / gist:731aa653982e2d905776
Created October 22, 2014 21:20
Convert time to human readable time in Javascript
function millisecondsToStr (milliseconds) {
// TIP: to find current time in milliseconds, use:
// var current_time_milliseconds = new Date().getTime();
function numberEnding (number) {
return (number > 1) ? 's' : '';
}
var temp = Math.floor(milliseconds / 1000);
var years = Math.floor(temp / 31536000);