Skip to content

Instantly share code, notes, and snippets.

View edysegura's full-sized avatar
👽
Always learning!

Edy Segura edysegura

👽
Always learning!
View GitHub Profile
@edysegura
edysegura / box-model.css
Last active August 29, 2015 13:56
[CSS] A basic CSS Reset with box-sizing
*, *::before, *::after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@edysegura
edysegura / .htaccess
Last active August 29, 2015 13:57
URL Redirection
RewriteEngine On
RewriteRule ^(.*)$ http://www.newaddress.com/$1 [L,R=301]
@edysegura
edysegura / redirect.php
Last active August 29, 2015 13:57
URL Redirection
<?
Header('HTTP/1.1 301 Moved Permanently');
Header('Location: http://www.your-new-address-here.com');
?>
@edysegura
edysegura / redirect.jsp
Created March 19, 2014 12:17
URL Redirection
<%
response.setStatus(301);
response.setHeader("Location", "http://www.your-new-address-here.com/");
response.setHeader("Connection", "close");
%>
@edysegura
edysegura / index.html
Last active September 16, 2015 23:14
A Pen by Edy Segura.
<label>
<input type="checkbox" />
<span>Learn front-end</span>
</label>
@edysegura
edysegura / html5-validation-message.js
Last active April 28, 2023 06:22
How to prevent the browser from showing default HTML5 validation error message bubble?
document.addEventListener('invalid', (function(){
return function(e) {
//prevent the browser from showing default error bubble / hint
e.preventDefault();
// optionally fire off some custom validation handler
// myValidation();
};
})(), true);
@edysegura
edysegura / extend-html-dom.js
Last active September 16, 2015 23:12
[JS] How to extend the HTML DOM?
HTMLElement.prototype.remove = function() {
this.parentNode.removeChild(this);
};
document.querySelector("#a").remove();
@edysegura
edysegura / Todo.groovy
Last active August 29, 2015 14:05
Groovy learning - Todo Case
public class Todo {
def name
def note
public static void main(String[] args) {
def todos = [
new Todo([name:'1', note:'One']),
new Todo([name:'2', note:'Two']),
new Todo([name:'3', note:'Three']),
@edysegura
edysegura / EventService.groovy
Created November 27, 2014 18:54
Grails Goodness: Using Hibernate Native SQL Queries
package com.ericsson.tv.saas.portal
import org.hibernate.transform.AliasToEntityMapResultTransformer
class EventService {
def sessionFactory
def historyReport(currentUser) {
def report = [:]
def "Should return the number of events for each month of all events"() {
given:
controller.eventService = Mock(EventService) {
historyReport() >> [
"2012": ["eventCount" : 6, "monthlyCount" : ["December" : 4, "November" : 1, "January" : 1]],
"2011": ["eventCount" : 3, "monthlyCount" : ["October" : 3]]
]
}
when: