Skip to content

Instantly share code, notes, and snippets.

View ericduran's full-sized avatar
🎯
Focusing

Eric J. Duran ericduran

🎯
Focusing
View GitHub Profile
@ericduran
ericduran / .gitconfig
Last active September 24, 2015 11:37
My git config
[user]
name = Eric J. Duran
email = eric.duran7@gmail.com
[color]
ui = true
[alias]
br = branch
ci = commit
@ericduran
ericduran / gist:1018300
Created June 10, 2011 05:49
Validate the html5 step attribute in PHP
<?php
/**
* php port from C++
* All the logic taken from the chrome/webkit/idk team ;)
* http://codesearch.google.com/#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/html/NumberInputType.cpp&type=cs&l=129&q=acceptableError&exact_package=chromium
*/
define ("DBL_MANT_DIG", 16);
define ("FLT_MANT_DIG", 16);
@ericduran
ericduran / GrowlDismissAll.scpt
Created March 14, 2012 14:19
Applescript for Dismissing all Growl notifications.
# Dismiss all Growl notifications.
#
# If you're using this snippet with alfred and the power-pack
# make sure to remove the default text alfred puts in there
# aka "on alfred_script(q)" & "end alfred_script". You could
# just paste the script as is.
tell application "System Events"
set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell
@ericduran
ericduran / gist:2352268
Created April 10, 2012 15:42
Project Euler challenge #1
#include <iostream>
using namespace std;
int main () {
int i = 1000;
int total = 0;
while (i--) {
if (i % 3 == 0 || i % 5 == 0) {
total += i;
@ericduran
ericduran / 8hr delete.js
Created January 9, 2013 22:01
Enhancing my gmail filters!
/**
* Using Google Apps Script to enhance my gmail filters.
*
* I constantly receive email that are important for a short period of time (When I order food online!!!!) but after
* the email is no longer relative (When I get my food!) I have no need for this email. Sadly they tend to pile up on me
* (I eat a lot).
*
* Anyways you can add this 8hrDelete.gs file to https://script.google.com and set it up on a "Time Driven" trigger at what
* ever time you'll like. I run it at midnight
*/
@ericduran
ericduran / Preferences.sublime-settings.json
Last active December 11, 2015 01:49
My Sublime Text 2 settings
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"font_face": "SourceCodePro-Regular",
"font_size": 12,
"ignored_packages":
[
"Vintage",
"Erlang",
"ASP",
"ActionScript",
@ericduran
ericduran / .zshrc
Last active December 14, 2015 09:59
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
ZSH_THEME="ericduran"
# Example aliases
alias ohmyzsh="subl ~/.oh-my-zsh"
alias finder-hidden-hide="defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder"
alias finder-hidden-show="defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder"
# Based on the agnoster's Theme (https://gist.github.com/3712874)
# With some a couple of small changes.
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
### Segment drawing
# A few utility functions to make it easy and re-usable to draw segmented prompts
CURRENT_BG='NONE'
# angularjs pushstate (history) support:
# See http://www.josscrowcroft.com/2012/code/htaccess-for-html5-history-pushstate-url-routing/
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]
</ifModule>
@ericduran
ericduran / .gitignore_global
Last active December 18, 2015 12:59
gitignore_global
# Hacks #
#########
.idea
# Compiled source #
###################
*.com
*.class
*.dll
*.exe