Skip to content

Instantly share code, notes, and snippets.

require 'digest/md5'
hash = {}
Dir.glob("**/*", File::FNM_DOTMATCH).each do |filename|
next if File.directory?(filename)
# puts 'Checking ' + filename
key = Digest::MD5.hexdigest(IO.read(filename)).to_sym
if hash.has_key? key
// ==UserScript==
// @name Straight Google
// @id straight_google_pokerface
// @version 1.17.13
// @author Pokerface - Kevin
// @namespace in.co.tossing.toolkit.google
// @description Remove URL redirection from google products
// @license GPL v3 or later version
// @downloadURL https://userscripts.org/scripts/source/121261.user.js
// @updateURL https://userscripts.org/scripts/source/121261.meta.js
_.mixin({
// This will parse a delimited string into an array of
// arrays. The default delimiter is the comma, but this
// can be overriden in the second argument.
CSVtoJSON: function( strData, strDelimiter ){
// Check to see if the delimiter is defined. If not,
// then default to comma.
strDelimiter = (strDelimiter || ",");
// FIX: add an ending carriage return if missing
@roshanca
roshanca / Makefile
Last active August 29, 2015 14:14 — forked from bpierre/Makefile
# JS files
JS_FINAL = js/project-name-all.js
JS_TARGETS = js/file1.js \
js/file2.js \
js/file3.js
# CSS files
CSS_FINAL = css/project-name-all.css
STYLUS_TARGETS = css/file1.styl \
FROM ubuntu:14.04
MAINTAINER Pan Jiabang, [email protected]
RUN \
# use aliyun's mirror for better download speed
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \
apt-get update && \
apt-get install -y nodejs curl git-core && \
# use nodejs as node

Problem

  • Using emmet in jsx files
  • Emmet expands text when js autocomplete needed
  • Using className instead of class

How it works

  • Install plugin RegReplace
  • Install plugin Chain Of Command

Fixing npm On Mac OS X for Homebrew Users

If you just want to fix the issue quickly, scroll down to the "solution" section below.

Explanation of the issue

If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you may see an error like this:

$ npm update npm -g
@roshanca
roshanca / angularjs-providers-explained.md
Last active August 29, 2015 14:27 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@roshanca
roshanca / gist:17a43778c7e03ef33959
Created November 19, 2015 05:10 — forked from Steven-Rose/gist:3943830
VI: Select all + delete, select all + copy
Select all and delete (actually move to buffer)
:%d
Select all and copy to buffer
:%y
Use p to paste the buffer.
@roshanca
roshanca / loading.ts
Created November 24, 2015 15:18 — forked from pdib/loading.ts
Create a loading spinner that disappears once the content is loaded with Angular 2.
@Component({
selector: 'spinner',
template: `<h1>spinner</h1>` // This will be displayed while loading.
})
class Spinner {
}
@Directive({
selector: "[loading]",
inputs: ["loading"],