This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Lately I've been thinking about better ways of namespacing directives and more specifically | |
| the need to create global directives for one-off pieces of code that are specific to the | |
| context of given controller. Often the only reason I create a directive is because I need | |
| a link function to do some DOM manipulation. Here is my dirty little experiment: | |
| app.directive 'pxLink', -> | |
| link: ($scope, $el, $attrs) -> $scope[$attrs.pxLink]?($el, $attrs) | |
| <div class="thing" px-link="myLinker"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Gulp and plugins | |
| gulp = require('gulp') | |
| gutil = require('gulp-util') | |
| plugins = require("gulp-load-plugins")(scope: ["dependencies", "devDependencies"]) | |
| # Utilities | |
| grunt = require('grunt') | |
| glob = require('glob') | |
| path = require('path') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def update_all | |
| updated_styles = [] | |
| params[:styles].each do |style_params| | |
| style = styles.find(style_params[:id]) | |
| update_resource_attributes!(style, style_params) | |
| style.save! | |
| updated_styles << style | |
| end | |
| respond_with(updated_styles) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* custom extends start */ | |
| .view-header .button { | |
| /* $header-icon-color */ | |
| color: $header-icon-color; | |
| } | |
| .view-header { | |
| background-color: $header-background-color; | |
| border-bottom: $header-bottom-border-size solid $header-accent-color; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Netratings SiteCensus v53.js | |
| // COPYRIGHT 2007 Nielsen//Netratings | |
| function random() | |
| { | |
| random.seed = (random.seed*random.a + random.c) % random.m; | |
| return random.seed / random.m; | |
| } | |
| random.m=714025; | |
| random.a=4096; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| /** | |
| MSGAPP Tracking Script | |
| Modified for use within the Softchoice Pressly App | |
| **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SoftchoiceAddAnalyticsScript < PresslyMigrator::Seed | |
| def self.up | |
| account = Account.where(uid: 'softchoice').first | |
| if account && (site = account.sites.where(uid: 'link').first) | |
| # install analytics script for both apps | |
| site.apps.each do |app| | |
| app.scripts.create!(name: 'msgapp', | |
| type: 'js', | |
| source: load_source, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SoftchoiceAddAnalyticsScript < PresslyMigrator::Seed | |
| def self.up | |
| account = Account.where(uid: 'softchoice').first | |
| file_path = PresslyDashboard.root.join('db/scripts/softchoice/msgapp.js') | |
| source = File.read(file_path) | |
| if account && (site = account.sites.where(uid: 'link').first) | |
| # install analytics script for both apps | |
| site.apps.each do |app| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SoftchoiceAddAnalyticsScript < PresslyMigrator::Seed | |
| def self.up | |
| account = Account.where(uid: 'softchoice').first | |
| file_path = PresslyDashboard.root.join('db/scripts/softchoice/msgapp.js') | |
| source = File.read(file_path) | |
| if account && (site = account.sites.where(uid: 'link').first) | |
| # install analytics script for both apps | |
| site.apps.each do |app| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var navItems = _.chain(Pressly.Manifest.sections).select(function(section) { | |
| // Select all the sections which are not shallow and.. | |
| return !section.shallow && section.assets.length > 0; | |
| }).collect(function(section) { | |
| // Collect assets from these section which includes.. | |
| return _(section.assets).detect(function(asset) { | |
| // The first article asset it finds that .. | |
| return asset.type === "article" && asset.children && _(asset.children).any(function(child) { | |
| // Has a a child asset with type of image | |
| return child.type === "image"; |