Skip to content

Instantly share code, notes, and snippets.

View djadriano's full-sized avatar
:octocat:
Coding...

Adriano Fernandes djadriano

:octocat:
Coding...
View GitHub Profile
@djadriano
djadriano / gist:2212494
Created March 27, 2012 04:16
structure for front-end project
# -----------------------------------
# create front-end structure
# By Adriano Fernandes
# twitter.com/djadriano
# djadrianof@gmail.com
# -----------------------------------
# -----------------------------------
#get parameters
# -----------------------------------
@djadriano
djadriano / gist:2503940
Created April 26, 2012 22:55
Backbone.js mixins
var myMixin = {
foo : 'bar',
method_x : function() {
return true;
}
};
@djadriano
djadriano / gist:2775398
Created May 23, 2012 14:02
extend array objects with jquery
copy = {
bundle_offers : [
{
title : 'teste1'
},
{
title : 'teste2'
}
]
}
@djadriano
djadriano / gist:2830150
Created May 29, 2012 19:22
reset buttons for fixes in all browsers
// reset all buttons
input[type="submit"],
button {
border: 0;
padding: 0;
cursor: pointer;
outline: none; /* for good measure */
overflow: visible; /* removes extra side padding in IE */
}
@djadriano
djadriano / gist:2975860
Created June 22, 2012 23:58
keyframe mixins in scss
// ======================================================================
// Animation.scss
// - contains helpers for keyframes animation in css3
// - Only functionally with Sass 3.2.0 Alpha and Compass 0.13.alpha
// ======================================================================
@mixin animation-name($name) {
-webkit-animation-name: $name;
-moz-animation-name: $name;
-ms-animation-name: $name;
@djadriano
djadriano / gist:4550153
Created January 16, 2013 19:41
good regex tips
localize the first and final line
start the line: ^
end of the line: $
replace www. to a tag:
\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))
<a href="http://\1" target="_blank">\1</a>
@djadriano
djadriano / gist:4735242
Last active December 12, 2015 07:18
solution for xdr and cross domain problem with ie when you need make a ajax request or send.
if ($.browser.msie && window.XDomainRequest) {
var xdr = new XDomainRequest();
xdr.open("POST",'http://yoururl.com');
xdr.send( ajax_data );
xdr.onerror = function(){
console.log('error');
};
@djadriano
djadriano / gist:5015729
Created February 22, 2013 19:01
command for generate base64 font
base64 -b0 caminho do arquivo (control-c no arquivo e colar aqui) | pbcopy
@djadriano
djadriano / gist:5041994
Created February 26, 2013 20:43
svn tips
// find .svn files
find . -type d -name .svn
// remove .svn files
rm -rf `find . -type d -name .svn`
@djadriano
djadriano / gist:6804116
Created October 3, 2013 03:00
lightbox angularjs directive
EurodanceApp.directive('modal', function($compile){
var template = '<h2>{{title}}</h2><p>{{content}}</p>';
return {
restrict : 'A',
scope : true,
link : function( scope, element, attrs ) {
scope.title = attrs.title;