Skip to content

Instantly share code, notes, and snippets.

View p0rsche's full-sized avatar
🧨
Working from home

Vladimir Gerasimov p0rsche

🧨
Working from home
View GitHub Profile
@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";
};
<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()
<?php
/**
* Использование:
* $v = new VideoThumb($link);
* $v->getVideo(); //Ссылка на видео
* $v->getTitle(); //Название ролика
* $v->fetchImage($path) //Скачать самое большое превью ролика
*
* Прогнать тест:
#! /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
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') {
@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
/*!
* Grunt
* $ npm install grunt-contrib-uglify grunt-autoprefixer grunt-contrib-cssmin grunt-contrib-imagemin grunt-contrib-sass grunt-contrib-watch grunt-contrib-concat grunt-contrib-clean grunt-contrib-jshint grunt-notify --save-dev
*/
module.exports = function(grunt) {
grunt.initConfig({
// Sass
@p0rsche
p0rsche / LICENSE.txt
Last active August 29, 2015 14:16 — forked from jed/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@p0rsche
p0rsche / Gruntfile.js
Last active August 29, 2015 14:25 — forked from jshawl/Gruntfile.js
Grunt + Sass + Autoprefixer
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options:{
style:'compressed'
},
files: {
'css/style.css' : 'scss/style.scss'