This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Usage | |
| <div resize="{'attr': 'height', '*': 0.375}"> ... | |
| */ | |
| 'use strict'; | |
| Application.directive('resize', function ($window) { | |
| return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // HTML | |
| // <input type='file' onchange="angular.element(this).scope().setImage(this)" style="width:350px; padding:5px; border:1px solid; border-color:#c3c3c3 #ddd #ddd #c3c3c3;" /> | |
| // JS | |
| $scope.maximumImageSize = 5 * 1024 * 1024; | |
| $scope.validImageExtensions = ['jpg', 'jpeg', 'bmp', 'gif', 'png']; | |
| $scope.setImage = function(input) { | |
| if (input.files && input.files[0] && input.files[0].name) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // <input number-format type="text" ng-model="value" /> | |
| angular.module('module', []) | |
| .directive('numberFormat', function($filter) { | |
| return { | |
| require: 'ngModel', | |
| link: function(scope, element, attrs, ngModel) { | |
| var prepare = function(value) { | |
| var numb = Number(value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = require('request'); | |
| var xml2js = require('xml2js'); | |
| /* | |
| código do serviço. | |
| 40010 SEDEX | |
| 41106 PAC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aria2c -x10 -j1 -ilinks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var winston = require('winston'); | |
| var logger = new (winston.Logger)({ | |
| transports: [ | |
| new (winston.transports.Console)({ json: false, timestamp: true }), | |
| new winston.transports.File({ filename: __dirname + '/debug.log', json: false }) | |
| ], | |
| exceptionHandlers: [ | |
| new (winston.transports.Console)({ json: false, timestamp: true }), | |
| new winston.transports.File({ filename: __dirname + '/exceptions.log', json: false }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "deb http://www.rabbitmq.com/debian/ testing main" > /etc/apt/sources.list.d/rabbitmq.list | |
| wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | |
| sudo apt-key add rabbitmq-signing-key-public.asc | |
| apt-get update | |
| apt-get install rabbitmq-server -y | |
| service rabbitmq-server start | |
| rabbitmq-plugins enable rabbitmq_management | |
| rabbitmqctl add_user admin password | |
| rabbitmqctl set_user_tags admin administrator | |
| rabbitmqctl set_permissions -p / admin ".*" ".*" ".*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -Xmn256m -Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:PermSize=512m -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require("express"); | |
| var app = express(); | |
| app.configure(function() { | |
| app.use(express.static(__dirname + './boxes')); | |
| app.use(express.errorHandler()); | |
| }); | |
| var port = 8080; | |
| app.listen(port); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for key in `redis-cli "KEYS" "app:scope:*" | awk '{print $1}'` | |
| do redis-cli "DEL" "$key" | |
| done |