Skip to content

Instantly share code, notes, and snippets.

View sherpic's full-sized avatar

Andrew Sherstobitov sherpic

View GitHub Profile
#Python 2
python -m SimpleHTTPServer 8080
#Python 3
python3 -m http.server 8113
86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace
@sherpic
sherpic / ember-view.js
Created November 26, 2015 01:11 — forked from xypaul/ember-view.js
Ember - didInsertElement - afterRenderEvent - Ultimate solution
Ember.View.reopen({
didInsertElement : function(){
this._super();
Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent);
},
afterRenderEvent : function(){
// implement this hook in your own subclasses and run your jQuery logic there
}
});
@sherpic
sherpic / LazyLoad.js
Created April 26, 2016 07:14 — forked from yocontra/LazyLoad.js
lazy loading react components, useful for video/audio/etc
var React = require('react');
var events = require('add-event-listener');
var isVisible = require('../isVisible');
var LazyLoad = React.createClass({
displayName: 'LazyLoad',
propTypes: {
distance: React.PropTypes.number,
component: React.PropTypes.node.isRequired,
children: React.PropTypes.node.isRequired
@sherpic
sherpic / parallax.vue
Created April 30, 2016 19:42 — forked from esahione/parallax.vue
Parallax Vue
<template lang="jade">
.wrapper
section.parallax-background(:style="parallaxStyle", :id="parallaxId")
.parallax-content(v-if="pcontent != 0")
slot
.scroll-down(v-if="pscrolldown != 0")
</template>
<script>
require('jeet')
@sherpic
sherpic / directive-delay-execute.js
Created April 30, 2016 19:51 — forked from 599316527/directive-delay-execute.js
Vue.js directive: delay execute
var Vue = require('vue');
Vue.directive('delay-execute', {
acceptStatement: true,
bind: function () {
this._delayRunTimeout = parseInt(this.arg, 10) || 1000;
},
update: function (handle) {
this.reset();
this._delayRunTimer = setTimeout(handle, this._delayRunTimeout);
@sherpic
sherpic / ContactList.vue
Created April 30, 2016 19:55 — forked from jeremykendall/ContactList.vue
Vue component data n00b issues
<template>
<div>
<div class="row">
<div class="col-md-12">
<div class="filter fdiv" id="filter">
<button type="button" v-on:click="toggleSelectAll" class="btn btn-primary">
<span v-if="selectAllActive"><i class="fa fa-check-square"></i> <span class="micit-button-label">Deselect</span> all</span>
<span v-else><i class="fa fa-square"></i> <span class="micit-button-label">Select</span> all</span>
</button>
<div class="btn-group" role="group">
@sherpic
sherpic / gist:50eac58dd2b53421886c31dc72d44bd3
Created May 27, 2016 21:11 — forked from jaredhanson/gist:2559730
Restify and Passport /cc Hal Robertson
// Based off example code from Hal Robertson
// https://github.com/halrobertson/test-restify-passport-facebook
// See discussion: https://groups.google.com/forum/?fromgroups#!topic/passportjs/zCz0nXB_gao
var restify = require('restify')
// config vars
var FB_LOGIN_PATH = '/api/facebook_login'
var FB_CALLBACK_PATH = '/api/facebook_callback'
var FB_APPID = '<<YOUR APPID HERE>>'
@sherpic
sherpic / gulpfile.js
Created May 29, 2016 02:03 — forked from narirou/gulpfile.js
gulpfile.js : auto restart & livereload the server with gulp
'use strict';
var gulp = require( 'gulp' ),
gutil = require( 'gulp-util' ),
fork = require( 'child_process' ).fork,
tinyLr = require( 'tiny-lr' ),
async = require( 'async' );
var dirs = {
app: [
@sherpic
sherpic / app.js
Created May 31, 2016 07:27 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');