Skip to content

Instantly share code, notes, and snippets.

View p0rsche's full-sized avatar
🧨
Working from Shelter Coworking

Vladimir Gerasimov p0rsche

🧨
Working from Shelter Coworking
View GitHub Profile
@p0rsche
p0rsche / gist:11164926
Last active August 29, 2015 14:00 — forked from HashNuke/gist:608259
Undoing git push
# 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
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') {
#! /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
<?php
/**
* Использование:
* $v = new VideoThumb($link);
* $v->getVideo(); //Ссылка на видео
* $v->getTitle(); //Название ролика
* $v->fetchImage($path) //Скачать самое большое превью ролика
*
* Прогнать тест:
<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()
<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()
@p0rsche
p0rsche / gist:2763377
Created May 21, 2012 17:17
jQuery.extend implementation in pure JS
var utils = function(){
"use strict";
var _class2type = {};
var _type = function( obj ) {
return obj == null ?
String( obj ) :
_class2type[ toString.call(obj) ] || "object";
};