Skip to content

Instantly share code, notes, and snippets.

@MoshDev
MoshDev / installRun.gradle
Last active June 9, 2023 15:41
Install and Run Android App Using Gradle Task
//Place this script inside your application module build.gradle
//It will create a new task(s) based on your application variants within (run) group
//sample: ./gradlew installRunDebug
//sample: ./gradlew installRunStagDebug
project.afterEvaluate {
android.applicationVariants.all { variant ->
task "installRun${variant.name.capitalize()}"(type: Exec, dependsOn: "install${variant.name.capitalize()}", group: "run") {
commandLine = ["adb", "shell", "monkey", "-p", variant.applicationId + " 1"]
doLast {
/*
* Part of Ensemble CSS
* related to AdvCandleStickChart
*
* extracted by Nicolas
* July 20th, 2016
*
* Initial CSS:
* http://grepcode.com/file/repo1.maven.org/maven2/org.jbundle.javafx.example/org.jbundle.javafx.example.ensemble/0.9.0/ensemble/ensemble2.css?av=f
*
# to install the latest stable version:
brew install scala --with-docs
# to install scala-2.10:
brew install https://raw.github.com/gist/4340744/scala.rb --with-docs
# to switch versions (from https://github.com/mxcl/homebrew/wiki/External-Commands):
brew switch scala 2.9.2
brew switch scala 2.10.0
@Centaur
Centaur / lens.scala
Created October 21, 2015 15:05
Nested Lens
import monocle.macros.Lenses
import language.higherKinds
@Lenses("_") case class Street(name: String)
@Lenses("_") case class Address(street: Street)
@Lenses("_") case class Company(addresses: Seq[Address])
@Lenses("_") case class Employee(company: Company)
object ILens {
val employee = Employee(Company(Seq(
@teabyii
teabyii / Riot-compiler.md
Last active November 15, 2018 09:11
Riot-compiler 代码的简单解读

Riot 源码阅读笔记 -- compiler

关于 Riot 的 compiler,具体请见:[Riot compiler]

之前在 [Riot 源码阅读笔记] 中提到另挖坑来聊聊 Riot 提供的 template + logic compiler 是怎么干活的,于是有了这一篇文章... (其实大部分都是正则,正则)

Riot 提供了两种方式,分别是 pre-compile 和直接在页面使用 script[type="riot/tag"],都是用的同一个 compiler 来处理代码的解析,在真实环境时推荐使用 pre-compile 的方式。

在页面使用 script[type="riot/tag", src="path"] 和 React 在页面使用 script[type="text/jsx", src="path"] 一样,都是用了 ajax 来请求文件内容,跨域就拜拜了,请知悉。

@jcouyang
jcouyang / vpn
Last active August 29, 2015 14:03
connect cisco anyconnect in terminal
#!/bin/sh
/opt/cisco/anyconnect/bin/vpn -s $1 blur.blur.com <<"EOF"
0
your.name
your.password
y
exit
EOF
@spoike
spoike / reflux.js
Created June 29, 2014 22:23
A simpler implementation of React.JS's Flux
var EventEmitter = require('events').EventEmitter,
_ = require('lodash');
/**
* Creates an action functor object
*/
exports.createAction = function() {
var action = new EventEmitter(),
eventLabel = "action",
@mestizo
mestizo / gist:9167834
Last active February 27, 2023 22:39
Completely disable IPv6 on OSX
#To Get List of Hardware
sudo networksetup -listallhardwareports
#To Disable IPv6 on Wifi Adapter
sudo networksetup -setv6off wi-fi
#To Disable IPv6 on Built-in Ethernet Adapter
sudo networksetup -setv6off Ethernet
@SamuelMarks
SamuelMarks / egghead_YouTube_downloader.py
Last active November 3, 2018 09:32
Simple algorithm to download all the egghead.io videos in highest-quality from YouTube.
"""
Simple algorithm to download all the egghead.io videos in highest-quality from YouTube.
Run from the directory you want the videos to appear. Renames them so that they have the video number + omit the repetitive "Egghead.io - AngularJS -" text.
Installing dependency:
$ pip install git+https://github.com/NFicano/pytube#egg=pytube
"""
from pytube import YouTube #, exceptions as YTD_exceptions
@itang
itang / sbtnew
Last active December 20, 2015 00:49
sbtnew => sbt new project shell
#!/bin/bash
#-----------------------------------------------------------------------------
# Modified By itang
#-----------------------------------------------------------------------------
## Origin info
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Purpose: Create an SBT project directory structure with a few simple options.