Skip to content

Instantly share code, notes, and snippets.

@vmlinz
vmlinz / picture_uploader.rb
Created January 16, 2016 11:45
PictureUploader with carrierwave and qiniu
# encoding: utf-8
class PictureUploader < CarrierWave::Uploader::Base
UPLOADER_IMAGE_VERSION_NAMES = %w( 320x240 480x320 640 800 )
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
@vmlinz
vmlinz / 0_reuse_code.js
Created February 10, 2016 07:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@vmlinz
vmlinz / gist:80bbf5aec7cbb452e014
Created February 10, 2016 07:18 — forked from geekdada/gist:53eb32e1032325a2ee60
My Chrome Extensions
1Password: Password Manager and Secure Wallet https://agilebits.com/onepassword
Adblock Plus https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaibdccddilifddb
Alisec Extension https://chrome.google.com/webstore/detail/lapoiohkeidniicbalnfmakkbnpejgbi
AngularJS Batarang https://chrome.google.com/webstore/detail/ighdmehidhipcmcojjgiloacoafjmpfk
Awesome Screenshot: Capture &amp; Annotate https://chrome.google.com/webstore/detail/alelhddbbhepgpmgidjdcjakblofbmce
@vmlinz
vmlinz / sshtest.yml
Created February 28, 2016 16:18
Ansible book to test ssh forwarding in trellis
---
- hosts: web:&{{ env }}
tasks:
- name: Test that git ssh connection is working.
command: ssh -T git@github.com
@vmlinz
vmlinz / periodic_sync_adapter.md
Created March 15, 2016 12:43
Udacity "Developing Android Apps" #Sheduled Synchronization instructor notes

Instructor Notes

Before completing the quiz above, make sure you have added the necessary code to configure periodic syncs.

The code in this video will create the logic to, when you start Sunshine, check if an account has been created for Sunshine and if not, create a new account and configure a periodic sync to start.

Instructions

FetchWeatherTask and the SunshineService are now just older, unused classes which do the same thing that the SunshineSyncAdapter class is doing now; remove them. Clean up the AndroidManifest.xml and remove SunshineService and the AlarmReciever from the xml.

@vmlinz
vmlinz / local-properties-buildconfig.md
Last active March 18, 2016 11:14
Using local.properties file to store sensitive information in Android projects

问题

我们常常需要在Android工程里面放一些比较敏感的信息,比如某些三方服务的API Key之类的信息。但是设置到工程中每次手工修改代码又很麻烦,于是我查看了一些资料,实现了在local.properties这个文件中保存敏感信息。同时因为local.properties这个文件默认被gitignore了,相对来说还是比较安全。

操作方法

在工程根目录的local.properties里面填入你想保存的敏感信息

比如MyTMDBApiKey=xxxx

@vmlinz
vmlinz / gist:26afd5f42d462b9142037819f99fcaff
Created May 16, 2016 15:47 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@vmlinz
vmlinz / gist:98c4adceb5b1a9121c71b3a62f93b4a4
Created May 16, 2016 15:48 — forked from dodyg/gist:5616605
Kotlin Programming Language Cheat Sheet Part 2

This is a quick guide to Kotlin programming language. The previous part of this guide is here

#Object Oriented

fun main(args : Array<String>) {
  class local (val x : Int)
  
  val y = local(10)
 println("${y.x}")
@vmlinz
vmlinz / .editorconfig
Created May 21, 2016 16:46
js and json editor config
root = true
[*]
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
[*.{js,json}]
indent_style = space