Skip to content

Instantly share code, notes, and snippets.

View tarkanlar's full-sized avatar

Tarkan Anlar tarkanlar

View GitHub Profile
var drinks = [
{ 'name': 'Coke', 'quantity': 2 },
{ 'name': 'Red Bull', 'quantity': 6 }
];
var currentDrinks = _.pluck(drinks, 'name');
console.log(currentDrinks);
// → [‘Coke’, ‘Red Bull’]
@tarkanlar
tarkanlar / gist:4db7344053d382b02096
Created January 13, 2015 16:23
Sending a warning message to the user before the application exits
Window.addWindowClosingHandler(new ClosingHandler() {
@Override
public void onWindowClosing(ClosingEvent event) {
event.setMessage("Are you sure you want to leave the application?");
}
});
app.directive('scrollSpy', function ($window) {
return {
restrict: 'A',
controller: function ($scope) {
$scope.spies = [];
this.addSpy = function (spyObj) {
$scope.spies.push(spyObj);
};
},
link: function (scope, elem, attrs) {
@tarkanlar
tarkanlar / README.md
Created December 6, 2012 00:25 — forked from rmm5t/README.md
Locale override examples for the timeago jQuery plugin (http://timeago.yarp.com)

This gist is now deprecated

Please visit the locales directory inside the main timeago repository intead.

@tarkanlar
tarkanlar / ajax_post.js
Created December 6, 2012 00:22 — forked from batandwa/ajax_post.js
jQuery - Send a form using Ajax
jQuery.post(
$(this).attr('action'),
$(this).serialize(),
function( output ) {
alert('Success...');
}
);
@tarkanlar
tarkanlar / gist:4220165
Created December 5, 2012 22:38 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}