There are benefits to switching the root view controller, although the transition options are limited to those supported by UIViewAnimationOptions, so depending on how you wish to transition between flows might mean you have to implement a custom transition - which can be cumbersome.
You can show t...
In the most straightforward implementation, the Onboarding flow can simply be presented in a modal context, since semantically the User is on a single journey.
[Apple Human Interface Guidelines – Modality][1]:
Consider creating a modal context only when it’s critical to get someone’s attention, ...
So the most used functions on Clojure map and filter have been modified to return transducers (composable algorithmic transformations), if not called with a collection. That means:
(map inc) returns a transducer and so does (filter odd?)
The advantage: the functions can be composed into a single f...
Generating simple blog engine
rails plugin new [engine name] --mountable
Famous engines examples are
Device (authentication gem for rails)
Spree (Ecommerce)
Here, we have created a user-defined exception called CustomError which is derived from the Exception class. This new exception can be raised, like other exceptions, using the raise statement with an optional error message.
class CustomError(Exception):
pass
x = 1
if x == 1:
rais...
This example shows how to catch custom Exception
class CustomError(Exception):
pass
try:
raise CustomError('Can you catch me ?')
except CustomError as e:
print ('Catched CustomError :{}'.format(e))
except Exception as e:
print ('Generic exception: {}'.format(e))
Output:...
In this example, function will return as soon as value var has 1
def func(params):
for value in params:
print ('Got value {}'.format(value))
if value == 1:
# Returns from function as soon as value is 1
print (">>>> Got 1")
...
This is a compact guide about how to quickly create an R package from your code. Exhaustive documentations will be linked when available and should be read if you want a deeper knowledge of the situation. See Remarks for more resources.
The directory where your code stands will be refered as ./, an...
The possibilities are endless. as you can use this concept to pull the version number from your build system; such as git and use that version number in your project.
CMakeLists.txt
cmake_minimum_required(VERSION 3.8)
project(project_name VERSION "0.0.0")
configure_file(${path to con...
From the Terminal command line
Get the current URL from Safari
osascript -e 'tell app "safari" to get the url of the current tab of window 1'
Get the active URL in Google Chrome
osascript -e 'tell app "google chrome" to get the url of the active tab of window 1'
Get the name of the web page in Safari
osascript -e 'tell app "safari" to get the name of the current tab of window 1'
Get the title of the web page in Google Chrome
osascript -e 'tell app "google chrome" to get the title of the active tab of window 1'
You're not limited to single line Applescript code. Here we take the previous two examples and combine them into a single function.
#!/bin/bash
pageinfo() {
osascript -e \
'tell app "safari"
tell the current tab of window 1
return {url & "\n" & ...
If you you want to pass some data with the timer trigger you can do it with the userInfoparameter.
Here is the simple approach that gives brief idea about how you can pass the data to triggered method from the Timer.
[Swift 3]
Timer.scheduledTimer(timeInterval: 1.0, target: self, selector:#selec...
In this example, three brief and comprehensive sub-examples are presented:
Loading weights from available pre-trained models, included with Keras library
Stacking another network for training on top of any layers of VGG
Inserting a layer in the middle of other layers
Tips and general rule-of-t...
A vignette is a long-form guide to your package. Function
documentation is great if you know the name of the function you need,
but it’s useless otherwise. A vignette is like a book chapter or an
academic paper: it can describe the problem that your package is
designed to solve, and then show ...
To generate json user model with username, password_hash, email_id, created_at, updated_at, type
mix phoenix.gen.json User users username:string email_id:string password_hash:string timestamps()
np.save and np.load provide a easy to use framework for saving and loading of arbitrary sized numpy arrays:
import numpy as np
a = np.random.randint(10,size=(3,3))
np.save('arr', a)
a2 = np.load('arr.npy')
print a2
The following code sample demonstrates a quick and easy means of encrypting and decrypting files using the AES symmetric encryption algorithm.
The code randomly generates the Salt and Initialization Vectors each time a file is encrypted, meaning that encrypting the same file with the same password ...
When you run mix phoenix.gen.html or mix phoenix.gen.json from command line, migrations are created in priv -> repo -> migrations in your project folder.
To run migrations type mix ecto.migrate.
To generate migrations for your project mix ecto.gen migrations <model_name>
To generate m...