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
/** | |
* Show preview of cropped image | |
*/ | |
uploader.onAfterAddingFile = function(item) { | |
$scope.cropped = {image: ''}; | |
var reader = new FileReader(); | |
reader.onload = function(event) { | |
$scope.$apply(function(){ | |
$scope.cropped.image = event.target.result; | |
}); |
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
trix-toolbar .button_group button::before { | |
background-image: none !important; | |
font-family: 'FontAwesome'; | |
font-size: 12px; | |
line-height: 28px; | |
} | |
trix-toolbar .button_group button.bold:before { | |
content: '\f032'; | |
} |
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
/** | |
* Use Croppie for a simple image cropping. | |
* @see https://github.com/Foliotek/Croppie | |
* @example | |
* <lh-croppie src="cropped.source" ng-model="cropped.image"></lh-croppie> | |
*/ | |
angular.module('lingohubApp').directive('lhCroppie', function () { | |
return { | |
restrict: 'E', | |
scope: { |
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
// BEFORE | |
var feedUrl = 'https://lingohub.com/blog/feed/rss2'; | |
$http.jsonp('https://ajax.googleapis.com/ajax/services/feed/load', {params: {v: '1.0', q: feedUrl, num:-1, callback:'JSON_CALLBACK'}}).success(function(data) { | |
$scope.entries = data.responseData.feed.entries; | |
angular.forEach($scope.entries, function (entry) { | |
entry.publishedDate = new Date(entry.publishedDate); | |
}); | |
}); |
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 text = "this is a {highlighted} text"; | |
var regex = /\{\S+?\}/g; | |
var html = text.replace(regex, '<mark>$&</mark>'); // $& = matched value = {highlight} | |
alert(html); // => "this is a <mark>{highlighted}</mark> text" | |
var regex2 = /\{(\S+?)\}/g; // you need ()-brackets to get $1 | |
var html2 = text.replace(regex2, '<mark>$1</mark>'); // $1 = first () = highlight | |
alert(html2); // => "this is a <mark>highlighted</mark> text" |
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
/** | |
* Modal provider. Adds state which will open a modal. | |
* Opens or closes modal on URL change. | |
*/ | |
app.provider('modalState', function($stateProvider) { | |
var provider = this; | |
var modalResult; | |
this.$get = function() { | |
return provider; | |
}; |
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
<a href="https://lingohub.com/projects" translate="projects_link"></a> | |
en.json: { "projects_link": "Projects" } | |
LingoHub creates: | |
de.json: { "projects_link": "Projekte" } |
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
/** | |
* This array is needed for canceling requests when changing the state/route. | |
* @type {Array} | |
*/ | |
var currentRequests = []; | |
/** | |
* Handles route changes. | |
*/ | |
app.run(['$rootScope', function($rootScope) { |
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
// AtScript | |
@Directive({ | |
selector: '[blink]' | |
}) | |
class Blink { | |
constructor(elment:Element, options:Options, timeout:Timeout) {} | |
} | |
// ES6 | |
class Blink { |
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
// AtScript | |
class MyClass { | |
methodA(name:string):int { | |
var length:int = name.length; | |
return length; | |
} | |
} | |
// ES6 | |
class MyClass { |