A mixin is just a module that can be added (mixed in) to a class. one way to do it is with the extend method. The extend method adds methods of the mixin as class methods.
module SomeMixin
def foo
puts "foo!"
end
end
class Bar
extend SomeMixin
def baz
puts "...
Create a file named '.jshintrc' in the root of your app, where package.json is.
*Note on windows: create a file named "jshintrc.txt". Then rename it to ".jshintrc." (notice the dot at the end).
This is a configuration file. It can for example tell jshint to ignore certain varia...
Create a file named: "Makefile" (with no extension) in the root of your app
Open it in a text editor and add this:
android:
gulp lint
gulp sass
ionic run android --device
ios:
gulp lint
gulp sass
ionic build ios
This will lint your app and ...
RxSwift offers many ways to create an Observable, let's take a look:
import RxSwift
let intObservale = Observable.just(123) // Observable<Int>
let stringObservale = Observable.just("RxSwift") // Observable<String>
let doubleObservale = Observable.just(3.14) // Observable&...
You can use npm install -g to install a package "globally." This is typically done to install an executable that you can add to your path to run. For example:
npm install -g gulp-cli
If you update your path, you can call gulp directly.
On many OSes, npm install -g will attempt to writ...
Every Windows Phone project contains App.cs class:
public sealed partial class App : Application
This class is your global application context.
General Application class usage:
App entry point, particularly for various activation contracts.
Application lifecycle management.
Application g...
When I first started managing the keyboard I would use separate Notifications in each ViewController.
Notification Method (Using NSNotification):
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
NSNotificationCenter.defaultCenter().a...
Many tasks require elevated privileges. You can elevate user privileges to Administrator level for your batch runtime using a shortcut:
Press alt+ and the batch file to a selected folder to create a shortcut.
Right click and select "Properties".
Select the "Shortcut&quo...
The following batch file will popup a UAC Prompt allowing you to accept elevated Administrator privileges for the batch session. Add your tasks code to :usercode section of the batch, so they run with elevated privileges.
@echo off
setlocal EnableDelayedExpansion
:: test and acquire admin rights
...
In most scripting languages, if a function call fails, it may throw an exception and stop execution of the program. Bash commands do not have exceptions, but they do have exit codes. A non-zero exit code signals failure, however, a non-zero exit code will not stop execution of the program.
This can...
Any nullable type is a generic type. And any nullable type is a value type.
There are some tricks which allow to effectively use the result of the Nullable.GetUnderlyingType method when creating code related to reflection/code-generation purposes:
public static class TypesHelper {
public stat...
You can check if a variable has been defined in a scope by using ColdFusion's built in StructKeyExists() function. This can be used inside a <cfif> tag to prevent error messages in the event you attempt to refer to a variable that does not exist. You can also use this function to determine whe...
This code sends a simple text-only email to [email protected]
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'The Profile Name',
@recipients = '[email protected]',
@body = 'This is a simple email sent from SQL Server.',
@subject = 'Simple email'
HTML content must be passed to sp_send_dbmail
SQL Server 2012
DECLARE @html VARCHAR(MAX);
SET @html = CONCAT
(
'<html><body>',
'<h1>Some Header Text</h1>',
'<p>Some paragraph text</p>',
'</body></html>'
)
SQL Server 2012
...
The first time a user runs a project's gradlew, it should be realized that it will do two key things:
Check to see if the version of the gradle used by the wrapper is already in ~/.gradle/wrapper/dists
If not, download the archive of the version from the internet
If you're in an environment t...
This is a relatively common mistake: You created an rect element, in a bar chart for instance, and you want to add a text label (let's say, the value of that bar). So, using the same variable that you used to append the rect and define its x and y position, you append your text element. Very logic, ...
Arrow is, vaguely speaking, the class of morphisms that compose like functions, with both serial composition and “parallel composition”. While it is most interesting as a generalisation of functions, the Arrow (->) instance itself is already quite useful. For instance, the following function:
sp...
A typed hole is a single underscore (_) or a valid Haskell identifier which is not in scope, in an expression context. Before the existance of typed holes, both of these things would trigger an error, so the new syntax does not interfere with any old syntax.
Controlling behaviour of typed holes
Th...