Skip to content

Instantly share code, notes, and snippets.

@clonn
clonn / readme.md
Last active August 29, 2015 14:10 — forked from max-mapper/readme.md
io.js 非官方聲明,中文版本

聲明: 此並非爲官方聲明。我並非爲 io.js 官方代表,如果有任何問題,歡迎在 node-forward 一起討論

io.js - what you need to know

io-logo-substack

  • io 內容主要會從 node v0.12 分支出來 ( node v0.12 是下一個正式版本,但是尚未釋出)
  • io.js 將會 完全相容 於 node.js
  • io.js 開發者大多於 node.js 核心貢獻者,這邊有關於 io.js 想法以及運作方針
@msoghoian
msoghoian / gist:ec6b2c41af7974542d10
Last active August 29, 2015 14:13
gridster dynamic columns
(function (angular) {
'use strict';
var app = angular.module('onfarm.dashboard');
app.directive('gridsterTest', function (utils) {
return {
restrict: 'A',
replace: false,
@notomato
notomato / gist:3463043
Created August 25, 2012 09:45
Example of a custom helper outputting cached assets using Assetic, Yui Compressor and LessPHP.
<?php
namespace app\extensions\helper;
use Assetic\AssetWriter;
use Assetic\AssetManager;
use Assetic\FilterManager;
use Assetic\Asset\AssetCache;
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
@codef0rmer
codef0rmer / pagenav_ngclass.js
Created September 19, 2012 15:23
Page Navigation Bar in Angular.js
var navList = angular.module('navList', []);
navList.controller('navCtrl', ['$scope', '$location', function ($scope, $location) {
$scope.navClass = function (page) {
var currentRoute = $location.path().substring(1) || 'home';
return page === currentRoute ? 'active' : '';
};
}]);
@aaronroberson
aaronroberson / add-cart-button.html
Last active November 13, 2015 13:41
Geekwise2 Day 7 - Shopping Cart
<button class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Add to cart</button>
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) +
$(window).scrollTop()) + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) +
$(window).scrollLeft()) + "px");
return this;
}
@jameskoster
jameskoster / functions.php
Created July 29, 2013 10:09
Mystile - Only display parent categories on homepage
add_filter( 'mystile_homepage_product_categories_params', 'homepage_parent_categories_only' );
function homepage_parent_categories_only( $params ) {
$params = 'parent="0"';
return $params;
}
@EpokK
EpokK / filterCut.js
Last active December 20, 2015 17:49
Limit the length of a string with a filter
/**
* Usage:
* {{some_text | cut:true:100:' ...'}}
* Options:
* - wordwise (boolean) - if true, cut only by words bounds,
* - max (integer) - max length of the text, cut to this number of chars,
* - tail (string, default: '&nbsp;&hellip;') - add this string to the input
* string if the string was cut.
*/
angular.module('ng').filter('cut', function () {
@jspaper
jspaper / application_controller.rb
Last active December 26, 2015 02:29
把mobile的request一律只render page#home (layout是mobile.html),之後就統一由angular接管route。
class ApplicationController < ActionController::Base
before_filter :mobile_view_redirect
layout :which_layout
def mobile_device?
request.user_agent =~ /Mobile|webOS|Android/
end
helper_method :mobile_device?
@mt3o
mt3o / prerendered-angular-repeat.html
Created November 8, 2013 21:07
Angular ng-repeat with server side prerendering for seo, with template as separate element
<span ng-bind="variableValue">Static indexed value</span>
<ul ng-include="'your/dynamic/list'">
<li>seo-friendly item1</li>
<li>seo-friendly item2</li>
</ul>
<script type="text/ng-template" id="your/dynamic/list">
<li ng-repeat="item in items" ng-bind="item.name"></li>
</script>