This file contains 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
# to undo a git push | |
git push -f origin HEAD^:master | |
# to get to previous commit (preserves working tree) | |
git reset --soft HEAD | |
# to get back to previous commit (you'll lose working tree) | |
git reset --hard HEAD^ | |
# removing remote branch |
This file contains 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 Model = Backbone.Model.extend({ | |
validation: { | |
dependsOn: function(value, attributeName, computedState) { | |
// computedState is the model's state after the current operation completes. | |
// You need to get the value of the other attribute from this, and not from the | |
// model it self because if both attributes are being set at the same time, | |
// model's value is not yet updated. | |
if(computedState.someAttribute === 'someValue') { |
This file contains 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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
This file contains 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
<?php | |
/** | |
* Использование: | |
* $v = new VideoThumb($link); | |
* $v->getVideo(); //Ссылка на видео | |
* $v->getTitle(); //Название ролика | |
* $v->fetchImage($path) //Скачать самое большое превью ролика | |
* | |
* Прогнать тест: |
This file contains 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
<script src="socket.io/socket.io.js"></script> | |
<script> | |
var heartbeatInterval; | |
var heartbeatCount = 0; | |
var socket = io.connect('http://192.168.0.110:8088'); | |
socket.on('connect', function connectFn(data) { | |
console.log('connected'); | |
var heartbeat = function heartbeatFn() |
This file contains 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
<script src="socket.io/socket.io.js"></script> | |
<script> | |
var heartbeatInterval; | |
var heartbeatCount = 0; | |
var socket = io.connect('http://192.168.0.110:8088'); | |
socket.on('connect', function connectFn(data) { | |
console.log('connected'); | |
var heartbeat = function heartbeatFn() |
This file contains 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 utils = function(){ | |
"use strict"; | |
var _class2type = {}; | |
var _type = function( obj ) { | |
return obj == null ? | |
String( obj ) : | |
_class2type[ toString.call(obj) ] || "object"; | |
}; |
NewerOlder