Skip to content

Instantly share code, notes, and snippets.

View chodorowicz's full-sized avatar

Jakub Chodorowicz chodorowicz

View GitHub Profile
@chodorowicz
chodorowicz / 0_reuse_code.js
Created June 22, 2014 22:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@chodorowicz
chodorowicz / javascript_resources.md
Created June 22, 2014 22:28 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@chodorowicz
chodorowicz / loader.php
Last active August 29, 2015 14:02
WordPress resources loader | #PHP #WordPress
<?php
class Loader {
private $theme_uri;
private $theme_dir;
function __construct($theme_uri, $theme_dir) {
$this->theme_uri = $theme_uri;
$this->theme_dir = $theme_dir;
}
@chodorowicz
chodorowicz / gulpfile.js
Last active November 22, 2017 10:41
simple gulpfile with stylus, browser sync,
// this method is currently broken
// better use vinyl-source-stream method
// http://fettblog.eu/gulp-browserify-multiple-bundles/
const gulp = require('gulp');
const browserify = require('browserify');
const transform = require('vinyl-transform');
const browserSync = require('browser-sync');
const reload = browserSync.reload;
const gutil = require('gulp-util');
@chodorowicz
chodorowicz / gulp-pipes-sharing.js
Created November 21, 2014 09:45
gulp pipe sharing using lazypipe
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var coffee = require('gulp-coffee');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var lazypipe = require('lazypipe');
// give lazypipe
var jsTransform = lazypipe()
.pipe(jshint)
module.exports = {
entry: [ __dirname + '/app/js/App.jsx'],
output: {
path: __dirname + '/web',
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.jsx$/,
loader: 'jsx-loader?insertPragma=React.DOM&harmony'
@chodorowicz
chodorowicz / webpack.config.js
Created June 23, 2015 08:56
webpack react babel config
module.exports = {
entry: [ __dirname + '/app/js/main.jsx'],
output: {
path: __dirname + '/web',
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
@chodorowicz
chodorowicz / ProductDetail.jsx
Last active August 29, 2015 14:23
Get single item in Alt (Flux) + React
var React = require("react");
var ProductsStore = require('../../stores/ProductsStore');
function getState(id) {
var product = ProductsStore.getProduct(id);
return {
product: product
};
}
var BrowserDetector = (function() {
var exports = {};
exports.isChrome = navigator.userAgent.indexOf('Chrome') > -1;
exports.isExplorer = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0;
exports.isFirefox = navigator.userAgent.indexOf('Firefox') > -1;
exports.isSafari = navigator.userAgent.indexOf("Safari") > -1;
exports.isOpera = navigator.userAgent.toLowerCase().indexOf("op") > -1;
if ((exports.isChrome)&&(exports.isSafari)) {exports.isSafari=false;}
if ((exports.isChrome)&&(exports.isOpera)) {exports.isChrome=false;}
@chodorowicz
chodorowicz / main.js
Created July 15, 2015 12:20
photoswipe disable zoom
{
zoomEl: false,
maxSpreadZoom: 1,
getDoubleTapZoom: function(isMouseClick, item) {
return item.initialZoomLevel;
}
pinchToClose: false
}