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
app.controller('appCtrl', function($scope, $filter) { | |
//.. | |
angular.forEach($scope.todos, function(todo) { | |
if (todo.id == updatedTodo.id) { | |
angular.extend(todo, updatedTodo); | |
} | |
}); | |
}); |
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
.controller('GlobalCtrl', function($rootScope, $scope, UserService, TodoService) { | |
$rootScope.users = []; | |
$rootScope.todos = []; | |
// Init. | |
UserService.all().then(function(users) { | |
angular.forEach(users, function(user) { | |
rootScope.users.push(user); | |
TodoService.all(user.id).then(function(todos) { |
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 array = []; | |
var index = $scope.array.indexOf(item); | |
$scope.array.splice(index, 1); |
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
angular.config(function($httpProvider) { | |
var authToken = $('meta[name="csrf-token"]').attr('content'); | |
$httpProvider.defaults.headers.common["X-CSRF-TOKEN"] = authToken; | |
}); |
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
# If you want to go directly to the DB | |
ActiveRecord::Base.connection.select_values("select id from users") | |
# If you already have a model | |
User.all(:select => :id).collect(&:id) | |
# In Rails 3 you can do this | |
User.pluck(:id) | |
# Rails helper |
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
.row | |
.col-lg-4 | |
%div{'ng:repeat' => "item in array.slice(0, array.length / 3)"} | |
{{item}} | |
.col-lg-4 | |
%div{'ng:repeat' => "item in array.slice(array.length / 3, array.length * 2/3)"} | |
{{item}} | |
.col-lg-4 | |
%div{'ng:repeat' => "item in array.slice(array.length * 2/3, array.length"} | |
{{item}} |
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
<ul class="nav nav-tabs"> | |
<li ng-repeat="team in teams" ng-class="{active: $index == 0}"> | |
<a href="#" data-toggle="tab">{{team.name}}</a> | |
</li> | |
</ul> |
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
<?php | |
function example_form($form, &$form_state) { | |
$form['foo'] = array( | |
'#type' => 'select', | |
'#title' => t('Foo'), | |
'#options' => array('one', 'two', 'three'), | |
'#ajax' => array( | |
'callback' => 'example_foo_callback', | |
'wrapper' => 'bar-sections' |
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
<?php | |
$obj = new ArrayObject(); | |
$obj['hello'] = NULL; | |
print 'ArrayObject<br >'; | |
var_dump(empty($obj['hello'])); // TRUE | |
var_dump(isset($obj['hello'])); // FALSE | |
var_dump(array_key_exists('hello', $obj)); // TRUE | |
class Test1 extends ArrayObject { |
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
npm install -g cordova | |
npm install -g ionic | |
ionic start myApp | |
cd myApp | |
ionic platform ios | |
ionic emulate ios | |
ionic run ios |