Deploy entire site to server using a single command grunt deploy
- Your web application exists on your local machine in a git repo
- You can log into your server via ssh without a password
- You are using grunt for your build process
| /** | |
| * Get a random floating point number between `min` and `max`. | |
| * | |
| * @param {number} min - min number | |
| * @param {number} max - max number | |
| * @return {number} a random floating point number | |
| */ | |
| function getRandomFloat(min, max) { | |
| return Math.random() * (max - min) + min; | |
| } |
| import { Injectable } from "@angular/core"; | |
| import { ReplaySubject, Observable } from "rxjs/Rx"; | |
| interface Message { | |
| channel: string; | |
| data: any; | |
| } | |
| @Injectable() | |
| export class MessageBus { |
| var MultiGetSet = function(opt){ | |
| var getType = function(o) { | |
| return ({}).toString.call(o).match(/\s([a-zA-Z]+)/)[1].toLowerCase() | |
| }; | |
| if(!opt.public || !opt.private) | |
| return opt.public; | |
| if(opt.handler && opt.handler.init) |
| import { Component, OnInit, OnDestroy } from '@angular/core'; | |
| import {Http} from "@angular/http"; | |
| import { LocalCacheService } from "./local-cache.service"; | |
| @Component({ | |
| selector: 'app-example', | |
| templateUrl: './app.component.html', | |
| styleUrls: ['./app.component.scss'] | |
| }) | |
| export class ExampleComponent implements OnInit, OnDestroy { |
| # first: | |
| lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
| sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
| # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
| # go to /usr/local/lib and delete any node and node_modules | |
| cd /usr/local/lib | |
| sudo rm -rf node* |
Deploy entire site to server using a single command grunt deploy
| #!usr/bin/python3 | |
| # -*- coding: UTF-8 -*- | |
| """This module is a sample of the OAuth2 authentication by Python3""" | |
| __version__ = "0.1.0" | |
| __author__ = "shin (shin.hateblo.jp)" | |
| __copyright__ = "(C) 2012 shin" | |
| __email__ = "s2pch.luck@gmail.com" | |
| __license__ = "Apache License 2.0" |
| import android.accessibilityservice.AccessibilityService; | |
| import android.accessibilityservice.AccessibilityServiceInfo; | |
| import android.util.Log; | |
| import android.view.accessibility.AccessibilityEvent; | |
| public class RecorderService extends AccessibilityService { | |
| static final String TAG = "RecorderService"; | |
| private String getEventType(AccessibilityEvent event) { |
Questions? Comments?
https://twitter.com/lnikkila
Handles clicks and long presses out of the box.
| public int getActionBarHeight() { | |
| int actionBarHeight = 0; | |
| TypedValue tv = new TypedValue(); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | |
| if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, | |
| true)) | |
| actionBarHeight = TypedValue.complexToDimensionPixelSize( | |
| tv.data, getResources().getDisplayMetrics()); | |
| } else { | |
| actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, |