Skip to content

Instantly share code, notes, and snippets.

<?php
$list_of_members = [];
foreach ($members as $member){
$list_of_members = [$member['user']['id']] =[$member['user']['name']]
}
return $list_of_members;
@oskarcalvo
oskarcalvo / error.log
Created August 10, 2015 21:43
Sinatra load with require 'sinatra_more' and give back an error
/home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require': cannot load such file -- warden (LoadError)
from /home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/sinatra_more-0.3.43/lib/sinatra_more/warden_plugin.rb:2:in `<top (required)>'
from /home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /home/vagrant/.rvm/gems/ruby-2.2.1/gems/sinatra_more-0.3.43/lib/sinatra_more.rb:5:in `<top (required)>'
from /home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from /home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /home/vag
$(document).ready(function () {
var simplemde = new SimpleMDE({
autofocus: true,
toolbar: ["bold", "italic", "heading", "|", "quote","code", "|", "unordered-list","ordered-list","table"],
element: document.getElementById("textarea_notes"),
showIcons: ["code", "table"],
});
});
oskar@workStation ~/.../curso $ php app/console doctrine:generate:entity
Welcome to the Doctrine2 entity generator
This command helps you generate Doctrine2 entities.
First, you need to give the entity name you want to generate.
<?php
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('googlelogin.settings');
$url = Url::fromUri('https://console.developers.google.com');
<?php
/**
* Implement hook_action_info
* @return array array with the new actions
*/
function module_name_action_info() {
return [
'name_of_callback' => [
'label' => t('Notify after comment'),
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "github"]
url = git@github.com:oskarcalvo/googlelogin.git
fetch = +refs/heads/*:refs/remotes/github/*
[branch "master"]
remote = github
<?php
return explode($delimitador,$texto)[$numero];
?>
<?php
$salida = function($numero){
$node = node_load($numero);
$node_array = (array) $node;
return $node_array;
};
print $salida(3016)['vid'];
?>
<?php
/**
* Fuente: http://php.net/manual/es/class.splfixedarray.php
*/
SplFixedArray implements Iterator , ArrayAccess , Countable {
/* Métodos */
public __construct ([ int $size = 0 ] )
public int count ( void )
public mixed current ( void )
public static SplFixedArray fromArray ( array $array [, bool $save_indexes = true ] )