Updated for Rails 4.0.0+
-
Set up the
bowergem. -
Follow the Bower instructions and list your dependencies in your
bower.json, e.g.// bower.json
{
| const R = require('ramda') | |
| const colors = ['green', 'blue', 'red'] | |
| const notEmpty = R.compose(R.not, R.isEmpty) | |
| const minLength = a => b => R.length(b) > a | |
| const hasPresetColors = x => R.indexOf(x, colors) !== -1 | |
| const input = { | |
| id: 1, | |
| userName: 'Random', |
| To allow c9 workspace to push to github org repository you must allow it in 3rd party access setup https://github.com/organizations/<org>/settings/oauth_application_policy | |
| Either remove restrictions or allow it from your https://github.com/settings/applications |
| /** | |
| * Returns PBKDF2 derived key from supplied password. | |
| * | |
| * Stored key can subsequently be used to verify that a password matches the original password used | |
| * to derive the key, using pbkdf2Verify(). | |
| * | |
| * @param {String} password - Password to be hashed using key derivation function. | |
| * @param {Number} [iterations=1e6] - Number of iterations of HMAC function to apply. | |
| * @returns {String} Derived key as base64 string. | |
| * |
| // Algorithm to calculate the Lowest Common Denominator | |
| @function gcd($a, $b){ | |
| @if $b == 0 { | |
| @return $a; | |
| } @else { | |
| @return gcd($b, $a%$b); | |
| } | |
| } | |
| // Example Use-case: |
Updated for Rails 4.0.0+
Set up the bower gem.
Follow the Bower instructions and list your dependencies in your bower.json, e.g.
// bower.json{
| // Linear Congruential Generator | |
| // Variant of a Lehman Generator | |
| var lcg = (function() { | |
| // Set to values from http://en.wikipedia.org/wiki/Numerical_Recipes | |
| // m is basically chosen to be large (as it is the max period) | |
| // and for its relationships to a and c | |
| var m = 4294967296, | |
| // a - 1 should be divisible by m's prime factors | |
| a = 1664525, | |
| // c and m should be co-prime |
Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist.
Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).
| function AttachmentCtrl($scope, $location, $timeout, Docs) { | |
| $(function() { | |
| $('#detail-form-doc').fileupload({ | |
| dataType: 'json', | |
| url: '/angular-ib/app/fileupload?id=' + $location.search().id, | |
| add: function(e, data) { | |
| $scope.$apply(function(scope) { | |
| // Turn the FileList object into an Array | |
| for (var i = 0; i < data.files.length; i++) { | |
| $scope.project.files.push(data.files[i]); |
| # app/controllers/users/password_controller.rb | |
| class Users::PasswordsController < Devise::PasswordsController | |
| def resource_params | |
| params.require(:user).permit(:email, :password, :password_confirmation) | |
| end | |
| private :resource_params | |
| end |
| # LiquidView is a action view extension class. You can register it with rails | |
| # and use liquid as an template system for .liquid files | |
| # | |
| # Example | |
| # | |
| # ActionView::Base::register_template_handler :liquid, LiquidView | |
| class LiquidView | |
| PROTECTED_ASSIGNS = %w( template_root response _session template_class action_name request_origin session template | |
| _response url _request _cookies variables_added _flash params _headers request cookies | |
| ignore_missing_templates flash _params logger before_filter_chain_aborted headers ) |