View example-coffee-chaining.coffee
req = $.get('foo.html') | |
.success (response) -> | |
do_something() | |
.error (response) -> | |
do_something() |
View example-coffee-promises.coffee
$.getJSON('/api/post.json') | |
.then (response) -> | |
# do something | |
response # if you would not return anything, promise would be fulfilled with undefined | |
.then (response) -> | |
# do something | |
undefined # necessary to prevent non-empty function body | |
.then null, (err) -> | |
# handle error |
View Disable app switcher
<!-- root dict node --> | |
<!-- <dict> --> | |
<key>NSUIElement</key> | |
<string>1</string> | |
<!-- other code inside dict --> | |
<!-- </dict> --> |
View scp
scp -r -C root@re.mo.te.host:/path/to/directory /local/path | |
# копировать с удаленного хоста к себе | |
# -r с вложенными директориями | |
# -С с компрессией |
View Store session between server restart
app.use(express.session({ | |
secret:'secret', | |
maxAge: new Date(Date.now() + 3600000), | |
store: new MongoStore( | |
{db:mongoose.connection.db}, | |
function(err){ | |
console.log(err || 'connect-mongodb setup ok'); | |
}) | |
})); |
View Focus after show.js
app = angular.module('App', []); | |
app.controller('MenuCtrl', function () {}); | |
app.directive('focusIf', [function () { | |
return function focusIf(scope, element, attr) { | |
scope.$watch(attr.focusIf, function (newVal) { | |
if (newVal) { | |
scope.$evalAsync(function() { | |
element[0].focus(); | |
}); | |
} |
View meta viewport
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"> |
View media queries css function
@media screen and (max-width: 960px) { | |
/** Style Rules here **/ | |
} |
View 01. vertical and horizontal centering
.Absolute-Center { | |
margin: auto; | |
position: absolute; | |
top: 0; left: 0; bottom: 0; right: 0; | |
} |
View auto delete old trash files
0 5 * * * /usr/bin/find /Users//.Trash -mindepth 1 -maxdepth 1 -mtime +14 -exec rm -rf {} \; |
OlderNewer