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 / 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:
@edysegura
edysegura / directive.js
Created December 12, 2014 12:57
How to observer an attribute in AngularJS directive
return function(scope, element, attrs) {
attrs.$observe('key', function(value) {
console.log('key=', value);
});
}
@edysegura
edysegura / html-to-quotes
Last active August 29, 2015 14:17
[REGEX] Put HTML code into quotes
find
^(\s+)?<
replace
$1'<
find
>$
replace
@edysegura
edysegura / no-user-selection.css
Created March 19, 2015 14:09
[CSS] How to disable user selection
.no-selection {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}