Tutorial by Examples: n

C-h f runs the function describe-function, which displays information on the usage and purpose of a given function. This is especially useful for functions that do not have a mapped key binding that can be used for documentation lookup via C-h k.
Another powerful & mature concurrency tool in Haskell is Software Transactional Memory, which allows for multiple threads to write to a single variable of type TVar a in an atomic manner. TVar a is the main type associated with the STM monad and stands for transactional variable. They're used m...
Filter odd elements: Prelude Data.Vector> Data.Vector.filter odd y fromList [1,3,5,7,9,11] :: Data.Vector.Vector
Vectors can be map'd and fold'd,filter'd andzip`'d: Prelude Data.Vector> Data.Vector.map (^2) y fromList [0,1,4,9,16,25,36,49,64,81,100,121] :: Data.Vector.Vector Reduce to a single value: Prelude Data.Vector> Data.Vector.foldl (+) 0 y 66
Zip two arrays into an array of pairs: Prelude Data.Vector> Data.Vector.zip y y fromList [(0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11)] :: Data.Vector.Vector
select returns a new hash with key-value pairs for which the block evaluates to true. { :a => 1, :b => 2, :c => 3 }.select { |k, v| k != :a && v.even? } # => { :b => 2 } When you will not need the key or value in a filter block, the convention is to use an _ in that place:...
Intersection of Hashes To get the intersection of two hashes, return the shared keys the values of which are equal: hash1 = { :a => 1, :b => 2 } hash2 = { :b => 2, :c => 3 } hash1.select { |k, v| (hash2.include?(k) && hash2[k] == v) } # => { :b => 2 } Union (...
Vim knows The Answer: :help 42 Vim will open the usr_42.txt document from the manual and show the following text: What is the meaning of life, the universe and everything? 42 Douglas Adams, the only person who knew what this question really was about is now dead, unfortunately. So now you m...
Cleaning and compiling code for iPhone, on project MyProject for schema Qa: xcrun xcodebuild clean \ -workspace "MyProject.xcworkspace" \ -scheme "YourScheme" \ -sdk iphoneos \ -configuration Debug \ archive \ -archivePath builds/MyProject.xcarchive...
These rules apply only if you use manual reference counting! You own any object you create By calling a method whose name begins with alloc, new, copy or mutableCopy. For example: NSObject *object1 = [[NSObject alloc] init]; NSObject *object2 = [NSObject new]; NSObject *object3 = [object2 ...
Here is a quick example of using multiple forms in one Django view. from django.contrib import messages from django.views.generic import TemplateView from .forms import AddPostForm, AddCommentForm from .models import Comment class AddCommentView(TemplateView): post_form_class = AddPo...
To install a new package, e.g. aeson: cabal install aeson
A Haskell project can either use the system wide packages or use a sandbox. A sandbox is an isolated package database and can prevent dependency conflicts, e. g. if multiple Haskell projects use different versions of a package. To initialize a sandbox for a Haskell package go to its directory and r...
After you have opened a split window in vim (as demonstrated by many examples under this tag) then you will likely want to control windows quickly. Here is how to control split windows using keyboard shortcuts. Move to split Above/Below: Ctrl + w and k Ctrl + w and j Move to split Left/Right...
The Window Object contains the following properties. PropertyDescriptionwindow.closedWhether the window has been closedwindow.lengthNumber of <iframe> elements in windowwindow.nameGets or sets the name of the windowwindow.innerHeightHeight of windowwindow.innerWidthWidth of windowwindow.scree...
<?php $to = '[email protected]'; $subject = 'Sending an HTML email using mail() in PHP'; $message = '<html><body><p><b>This paragraph is bold.</b></p><p><i>This text is italic.</i></p></body></html>'; $headers =...
Many unbound generic parameters, like those used in a static method, cannot be recovered at runtime (see Other Threads on Erasure). However there is a common strategy employed for accessing the type satisfying a generic parameter on a class at runtime. This allows for generic code that depends on ac...
# Deny access to a directory from the IP 255.0.0.0 <Directory /path/to/directory> order allow,deny deny from 255.0.0.0 allow from all </Directory> # Deny access to a file from the IP 255.0.0.0 <FilesMatch "^\.ht"> order allow,deny deny fro...
python-social-auth is a framework that simplifies the social authentication and authorization mechanism. It contains many social backends (Facebook, Twitter, Github, LinkedIn, etc.) INSTALL First we need to install the python-social-auth package with pip install python-social-auth or download ...
Synopsis A fully functional demo of Firebase v3 Web authentication viewable here. Sign in with Facebook, Github, Google, Twitter, password based, and anonymous accounts. The code, available on Github, is easy to read and follow and is well documented. The focus is on the fully functional authent...

Page 526 of 1088