Tutorial by Examples: c

Returns a partially applied function. > ((curry + 10) 20) 30 curryr can be used when the arguments need to be inserted at the end. In other words, (curryr list 1 2) will produce a function expecting some new-arguments .... When called, that new function will in turn call (list new-arguments ...
Accessing the array of calendars To access the array of EKCalendars, we use the calendarsForEntityType method: Swift let calendarsArray = eventStore.calendarsForEntityType(EKEntityType.Event) as! [EKCalendar] Iterating through calendars Just use a simple for loop: Swift for calendar in cale...
In Symfony, the built-in ChoiceType (and EntityType or DocumentType extending it), basicaly work with a constant choice list. If you want to make it work with ajax calls, you have to change them to accept any sumitted extra choices. How to start with an empty choice list ? When you build your...
This is an example to show how to change the allowed choices on a subCategory select field depending on the value of the category select field. To do that you have to make your subCategory choices dynamical for both client and server side. 1. Make the form dynamic on the client side for display / ...
In Ruby, there is always an implicit receiver for all method calls. The language keeps a reference to the current implicit receiver stored in the variable self. Certain language keywords like class and module will change what self points to. Understanding these behaviors is very helpful in mastering...
When you define a class or module, the implicit receiver becomes a reference to the class itself. For example: puts "I am #{self}" class Example puts "I am #{self}" end Executing the above code will print: "I am main" "I am Example"
Setup variables JUSERID=$[ ( $RANDOM % 100 ) + 1 ] JUSERNAME="admin" JUSEREMAIL="[email protected]" JUSERPASS="qweasd" DB="joomla_3" DBUSER="jdbuser" DBPASS="dbupass" DBPREFIX="prfx_" JOOMLAVERSION="3.6.2" ...
BEGIN TRY -- start error handling BEGIN TRANSACTION; -- from here on transactions (modifictions) are not final -- start your statement(s) select 42/0 as ANSWER -- simple SQL Query with an error -- end your statement(s) COMMIT TRANSACTION; -- finalize all transa...
Sometimes we have another editor somewhere else instead of TinyMCE (Wordpress Default Editor). That happen when we are creating our own Theme, Plugin or something specific; and we need to write and manipulate a type of post and save it into our WP Database. So, if you are on that situation, you can...
$basic_post_args = array( 'post_title' => 'My Basic Post', 'post_content' => 'This is a basic content', 'post_status' => 'publish', 'post_author' => 1, 'post_category' => array(8, 59) ); wp_insert_post( $basic_post_args );
$basic_page_args = array( 'post_title' => 'My Basic Page', 'post_content' => 'This is a basic content', 'post_type' => 'page', 'post_status' => 'publish', 'post_author' => 1 ); wp_insert_post( $basic_page_args );
The first thing we need is to tell karma to use Webpack to read our tests, under a configuration we set for the webpack engine. Here, I am using babel because I write my code in ES6, you can change that for other flavors, such as Typescript. Or I use Pug (formerly Jade) templates, you don't have to....
This returns the currently active spreadsheet, or null if there is none. var currentSheet = SpreadsheetApp.getActive(); var url = currentSheet.getUrl(); Logger.log( url );
sudo docker stats $(sudo docker inspect -f "{{ .Name }}" $(sudo docker ps -q)) Shows live CPU usage of all running containers.
HTML Import caching will sometimes mean that changes made to HTML files that get imported do not get reflected upon browser refresh. Take the following import as an example: <link rel="import" href="./my-element.html"> If a change is done to my-element.html after previo...
Modern browsers provide a classList object to ease manipulation of the element's class attribute. Older browsers require direct manipulation of the element's className property. * Note class names are not stored in the element's property in any particular order W3C DOM4 Removing one class from an...
Modern browsers provide a classList object to ease manipulation of the element's class attribute. Older browsers require direct manipulation of the element's className property. * Note class names are not stored in the element's property in any particular order W3C DOM4 Testing if an element cont...
In MySQL and other SQL dialects, NULL values have special properties. Consider the following table containing job applicants, the companies they worked for, and the date they left the company. NULL indicates that an applicant still works at the company: CREATE TABLE example (`applicant_id` INT, `...
class IPrototype { public: virtual ~IPrototype() = default; auto Clone() const { return std::unique_ptr<IPrototype>{DoClone()}; } auto Create() const { return std::unique_ptr<IPrototype>{DoCreate()}; } private: virtual IPrototype* DoClone() const = 0; virt...
To automatically reload vimrc upon save, add the following to your vimrc: if has('autocmd') " ignore this section if your vim does not support autocommands augroup reload_vimrc autocmd! autocmd! BufWritePost $MYVIMRC,$MYGVIMRC nested source % augroup END endif a...

Page 503 of 826