Skip to content

Instantly share code, notes, and snippets.

View lnaia's full-sized avatar
🏠
Working from home

Luis Naia lnaia

🏠
Working from home
View GitHub Profile
@lnaia
lnaia / web-servers.md
Last active August 29, 2015 14:06 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@lnaia
lnaia / validate_ipv6.rb
Last active August 29, 2015 14:07 — forked from cpetschnig/validate_ipv6.rb
Regular Expression Validation for IPv6 addresses in Ruby
# Regular Expression Validation for IPv6 addresses in Ruby
#
# Inspired by (if not to say copied from): http://forums.dartware.com/viewtopic.php?t=452
# Thanks, Dartware!
IPV6_REGEX = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f
@lnaia
lnaia / essential-javascript-links.md
Last active August 29, 2015 14:13 — forked from ericelliott/essential-javascript-links.md
# Essential JavaScript Links
@lnaia
lnaia / gist:d1399a626750b9a2eb39
Last active August 29, 2015 14:21 — forked from zachwaugh/gist:521133
Loading rails environment in a script placed anywhere
#!/usr/bin/env ruby
ROOT_PATH = File.expand_path File.dirname(__FILE__)
APP_PATH = "#{ROOT_PATH}/PATH_TO_YOUR_APP"
Dir.chdir APP_PATH
require File.join(File.dirname(__FILE__), *%w[config environment])
@lnaia
lnaia / index.html
Last active August 29, 2015 14:22 — forked from csusbdt/index.html
How to save json to drive
<html>
<head>
<!--
In this example, I started with the 5-minute example provided by Google
on the following page:
https://developers.google.com/drive/
I modified the example code, so that I could write the following
@lnaia
lnaia / time-ago.filter.js
Last active September 16, 2015 08:31
Angular JS time-ago.filter.js
angular.module('app')
.filter('timeAgo', function() {
return function(input) {
var res = '',
day = 24 * 60 * 60 * 1000,
hour = 60 * 60 * 1000,
minute = 60 * 1000,
second = 1000,
difference = new Date() - new Date(input);