Skip to content

Instantly share code, notes, and snippets.

View uhtred's full-sized avatar

Daniel França uhtred

View GitHub Profile
@uhtred
uhtred / goback.js
Created February 4, 2014 18:09
goBack to my site
function goBack(){
if( document.referrer.indexOf( window.location.host ) !== -1 ) {
history.go(-1);
} else {
window.location.href = window.location.host;
}
}
@uhtred
uhtred / owcs-api.js
Created February 24, 2014 21:06
OWCS Editor API
var OWCS_API = (function(){
var editorToolsBody = window.parent.document.body;
function Main(){}
Main.prototype = {
save: function(){
$( '#dijit_form_Button_44', editorToolsBody ).trigger( 'click' );
@uhtred
uhtred / waitFor.js
Last active August 29, 2015 13:57
@problem: When I have no control on some ajax or generated html and I need to wait for them. @Solution: Set an interval to check my conditions and them execute a callback.
@Problem: When I have no control on some ajax or generated html and I need to wait for them.
@Solution: Set an interval to check my conditions and them execute a callback.
function waitFor ( options ) {
options = $.extend( {}, {
callback: function(){},
condition: function(){ return true },
interval: 100
}, options);
@uhtred
uhtred / colors-names.js
Created May 12, 2014 17:45
Colors Names by Chirag
[
["000000", "Black"],
["000080", "Navy Blue"],
["0000C8", "Dark Blue"],
["0000FF", "Blue"],
["000741", "Stratos"],
["001B1C", "Swamp"],
["002387", "Resolution Blue"],
["002900", "Deep Fir"],
["002E20", "Burnham"],
@uhtred
uhtred / mixin-linear-gradient.scss
Created July 23, 2014 21:49
SASS: Mixin Linear Gradient
@mixin linear-gradient( $start: #f1f1f1, $from: 0%, $stop: #d9d9d9, $to: 100% ) {
background: $start;
background: -webkit-gradient(linear, left top, left bottom, from(ie-hex-str($start)), to(ie-hex-str($stop)));
background: -moz-linear-gradient(center top, $start $from, $stop $to);
background: -moz-gradient(center top, $start $from, $stop $to);
background: -webkit-linear-gradient(top, $start $from,$stop $to);
background: -o-linear-gradient(top, $start $from,$stop $to);
background: -ms-linear-gradient(top, $start $from,$stop $to);
background: linear-gradient(to bottom, $start $from,$stop $to);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{ie-hex-str($start)}', endColorstr='#{ie-hex-str($stop)}',GradientType=0 );
@uhtred
uhtred / .jsbeautifyrc
Created July 31, 2014 15:03
.jsbeautifyrc
Alterado para atender o Style Guide TQI
{
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
"brace_style": "collapse", // "expand", "end-expand", "expand-strict"
"indent_char": " ",
"indent_handlebars": false, // e.g. {{#foo}}, {{/foo}}
@uhtred
uhtred / mixin-triangle.scss
Last active August 29, 2015 14:05
SASS: Triangle Mixin
@mixin triangle( $orientation: 'right', $size: 5px, $color: #000000 ) {
width: 0;
height: 0;
$listH: right, left;
$listV: up, down;
@if index( $listH, $orientation ) {
border-top: $size solid transparent;
border-bottom: $size solid transparent;
@uhtred
uhtred / userscript-gp.js
Created August 29, 2014 20:48
userscript-gp.js
// ==UserScript==
// @name Relatório TQI
// @namespace tqi-gp
// @description Melhoria na tela de relatórios da TQI
// @include https://helpdesk.tqi.com.br/tqiextranet/*
// @version 1
// @grant none
// @require http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js
// @require http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.2/moment.min.js
// @require http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js
@uhtred
uhtred / sprite.scss
Last active August 29, 2015 14:06
CSS: Sprite icons both retina and normal.
$sprite-spacing: 1px;
$sprite-normal-map: sprite-map( "normal/*.png", $spacing: $sprite-spacing );
$sprite-normal: sprite-url( $sprite-normal-map );
$sprite-retina-map: sprite-map( "retina/*.png", $spacing: $sprite-spacing );
$sprite-retina: sprite-url( $sprite-retina-map );
@mixin generate-sprite-class( $map, $prefix: 'sprite--' ) {
@each $file in sprite-names( $map ) {
@uhtred
uhtred / mixin-truncate.scss
Created September 12, 2014 18:36
Truncate Mixin
%truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@mixin truncate( $width: 100px ) {
@extend %truncate;
width: $width;
}