Skip to content

Instantly share code, notes, and snippets.

angular.module 'myapp', []
.controller 'DemoController', class
constructor: (@$location) ->
@field = 'Field'
method: ->
'Method'
methodWithParam: (param) ->
@doug
doug / webcomponets.html
Created December 8, 2014 00:26
conditionally load webcomponents
<!-- Conditionally load WC polyfills -->
<script>
if ('registerElement' in document
&& 'createShadowRoot' in HTMLElement.prototype
&& 'import' in document.createElement('link')
&& 'content' in document.createElement('template')) {
// We're using a browser with native WC support!
} else {
document.write('<script src="/bower_components/webcomponentsjs/webcomponents.js"><\/script>');
}
@zaphar
zaphar / requirejs-shim-polymer-element
Last active December 23, 2015 02:09
A polymer custom element that can load requirejs modules. You may have to modify the paths to suite your setup.
<polymer-element name="require-js" attributes="libnames event">
<script>
(function() {
// Helper function to add a script.
var addScript = function(src) {
var script = document.createElement('script');
script.src = src;
var s = document.querySelector('script');
s.parentNode.insertBefore(script, s);
return script;
@pcolazurdo
pcolazurdo / Execute logstash
Last active December 2, 2016 09:20
LogStash configuration Sample
java -cp . logstash.runner agent -f logstash.conf -- web --backend elasticsearch:///?local
@nixzhu
nixzhu / cancelableDelayTask.swift
Last active March 11, 2017 17:10
Cancelable Delay Task
import Foundation
typealias CancelableTask = (cancel: Bool) -> Void
func delay(time: NSTimeInterval, work: dispatch_block_t) -> CancelableTask? {
var finalTask: CancelableTask?
var cancelableTask: CancelableTask = { cancel in
if cancel {
@cevaris
cevaris / build.sh
Created March 8, 2015 22:50
Debugging golang in GDB
go build -gcflags '-N'
@kbradnam
kbradnam / ipython_via_miniconda.md
Created May 23, 2014 18:25
Instructions for installing iPython by use miniconda

These instructions were originally provided by Michelle Gill and lightly adapted for our use.

Running this on lab server with sysadmin account

  1. cd /Volumes/Data/Korflab/Packages/
  2. mkdir Miniconda
  3. cd Miniconda
  4. Download the Python 2 version of Miniconda: curl -O http://repo.continuum.io/miniconda/Miniconda-3.4.2-MacOSX-x86_64.sh
  5. Make executable: chmod +x Miniconda-3.4.2-MacOSX-x86_64.sh
  6. Run script: sudo ./chmod +x Miniconda-3.4.2-MacOSX-x86_64.sh
import Foundation
/// Provides NSRegularExpression pattern matching
/// against strings in `switch` and `~=` statements
public struct Regex {
public let regexPattern: String
public let options: NSRegularExpression.Options
/// Initialize a `Regex` instance that
/// defaults to no options. Update as needed for
@tantaman
tantaman / polymer-requirejs
Last active April 5, 2018 07:29
polymer + requirejs : originally by Scott Miles from: http://jsbin.com/efojap/2/edit
<!doctype html>
<html>
<head>
<title>Polymer and RequireJS</title>
<script src="http://polymer.github.io/cdn/polymer.min.js"></script>
</head>
<body>
<!-- #foo -->
<div id="foo">the foo has no joy.</div>