Skip to content

Instantly share code, notes, and snippets.

View shubik's full-sized avatar

Alexander shubik

  • Teradek LLC
  • Irvine, CA
  • 20:49 (UTC +03:00)
View GitHub Profile
@shubik
shubik / reactjs1.js
Created March 24, 2015 17:24
Reactjs demo slide 1
/** @jsx React.DOM */
define([
'require',
'react'
], function (require) {
var React = require('react');
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-requirejs');
var debug = !grunt.option('prod');
return {
all: {
options: {
locale : 'en-us',
var _ = require('lodash');
module.exports = function(grunt) {
var prod = !!grunt.option('prod'),
path = grunt.config.get('src_path') + '/js/app/',
paths = [],
modules;
grunt.file.recurse(path, function(abspath, rootdir, subdir, filename) {
if (abspath.match(/\.js$/gi)) {
@shubik
shubik / gist:10955038
Created April 17, 2014 05:28
requirejs onBuildWrite to remove jsx!
onBuildWrite: function (moduleName, path, contents) {
return contents.replace(/jsx!/g, '');
}
@shubik
shubik / gist:10954882
Created April 17, 2014 05:24
Example of defining JSX dependency with JSX transformer
/** @jsx React.DOM */
define([
'require',
'react',
'jsx!views/components/grid'
], function (require) {
var React = require('react'),
GridView = require('jsx!views/components/grid');
@shubik
shubik / gist:10954124
Created April 17, 2014 05:04
JSX Grunt task
grunt.initConfig({
srcPath: 'src',
buildPath: 'public',
shell: {
'build-jsx': {
command: [
'jsx -x jsx <%= srcPath %>/jsx/ <%= srcPath %>/js/app/views/',
'rm -rf <%= src_path %>/js/app/views/.module-cache/'
].join(' && '),
└── src
├── js
| ├── app
| │   ├── collections
| │   ├── config
| │   ├── controllers
| │   ├── libs
| │   └── models
| └── vendor
└── jsx
└── src
└── js
├── app
│   ├── collections
│   ├── config
│   ├── controllers
│   ├── libs
│   ├── models
│   └── views
└── vendor
var _ = require('underscore'),
redis = require('redis'),
redis_conf = require('../../servers/config/redis.json'),
cached = {},
Dispatcher = function(key) {
var self = this,
key_base = 'app:dispatcher:';
this.key = key_base + key;
@shubik
shubik / gist:5746313
Created June 10, 2013 03:17
Defining permissions and custom roles for Prometheus ORM models
permissions: {
'create' : ['admin'],
'read' : ['admin', 'owner', 'company'],
'update' : ['admin', 'owner'],
'destroy' : ['admin', 'owner'],
'transfer' : ['admin', 'owner']
},
roles: {
company: {