Skip to content

Instantly share code, notes, and snippets.

View kurtisdunn's full-sized avatar

Kurtis Dunn kurtisdunn

View GitHub Profile
@benzittlau
benzittlau / Remove From Git By Extension
Created May 4, 2011 21:59
Remove all *.swp files from a git repository
git ls-files | grep '\.swp$' | xargs git rm
@incredimike
incredimike / variousCountryListFormats.js
Last active March 1, 2025 16:28
List of Countries in various Javascript data structures: Alphabetical country lists & Country data objects.
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: July 30, 2020
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
// or Laravel: https://github.com/squirephp/squire
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
//
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active February 10, 2025 17:30
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@tracend
tracend / excel.js
Created May 18, 2013 17:38
Export an excel sheet from a table with JavaScript (in IE)
// Export an excel sheet from a table with JavaScript (in IE):
// Usage: CreateExcelSheet("myid");
function CreateExcelSheet( el ) {
var x= document.getElementById( el ).rows;
var xls = new ActiveXObject("Excel.Application");
xls.visible = true;
@elijahmanor
elijahmanor / fake-server-unit-test.js
Last active August 28, 2018 09:23
Unit Test like a Secret Agent with Sinon.js
describe("getTweets - Server", function () {
var server, fakeData = [ /* ... */ ];
before(function () {
// Doesn’t work :( It’s JSONP!
server = sinon.fakeServer.create();
server.respondWith(
"GET",
"https://api.twitter.com/.../elijahmanor.json?count=5",
[200, { "Content-Type": "application/json" }, JSON.stringify(fakeData)]
@messified
messified / php-interview.md
Last active July 1, 2024 05:15
PHP Engineer Interview: What you should know

PHP Developer Interview: What you should know

1. What’s the difference between " self " and " this " ?

Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.

Source: When to use self vs this -stackoverflow

@elijahmanor
elijahmanor / readme.md
Created April 29, 2014 13:19
Angry Birds of Modern JavaScript Development

Angry Birds of Modern JavaScript Development

Title

Angry Birds of Modern JavaScript Development

Abstract

In this session Angry Birds uncover concepts of modern JavaScript development. Each bird represents an area of JavaScript along with its strengths. Some topics covered include code organization, events and messaging, MV* frameworks, prototyping and mocking, design patterns, linting, and build systems. The goal is to defeat the pigs and by doing so produce highly tested quality JavaScript code.

@soheilhy
soheilhy / nginxproxy.md
Last active February 9, 2025 14:45
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@manjeshpv
manjeshpv / passport.js
Last active February 21, 2025 08:33
Passport.js using MySQL for Authentication with Express
// config/passport.js
// load all the things we need
var LocalStrategy = require('passport-local').Strategy;
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
@kurtisdunn
kurtisdunn / random-css-background-image.jsp
Last active August 29, 2015 14:05
Random CSS background-image generated with JSP
<%
File imageDirectory = new File("./images");
String images[] = imageDirectory.list();
if(images != null){
int imageNumber = 0;
double randomNumber = Math.random();
int random2Digits = (int)(randomNumber * 100);
for(int i = 0; i < random2Digits; i++){