Skip to content

Instantly share code, notes, and snippets.

@vegetableman
vegetableman / scp.groovy
Created February 24, 2012 23:59
scp with groovy and ant
import groovy.util.AntBuilder;
import groovy.grape.Grape
Grape.grab(group:"org.apache.ant", module:"ant-jsch", version:"1.8.1", classLoader:this.class.classLoader.rootLoader)
Grape.grab(group:"com.jcraft", module:"jsch", version:"0.1.42", classLoader:this.class.classLoader.rootLoader)
def ant = new AntBuilder();
ant.scp(
trust:"true",
file:"vignesh@localhost:/home/vignesh/Documents/files/file.txt",
todir:"/home/vignesh/Documents",
@vegetableman
vegetableman / HNCollapseEx
Created March 18, 2012 02:18
Also expand on click of HNCollapse Bookmarklet
(function() {
/*if (window.location.hostname != 'news.ycombinator.com') {
window.location = 'http://news.ycombinator.com';
}*/
if (window.HNCOLLAPSE) {
window.HNCOLLAPSE = false;
}
else{
window.HNCOLLAPSE = true;
@vegetableman
vegetableman / gist:9953242
Created April 3, 2014 12:14
jekyll generator to iterate through image dir and concatenate files under subdirectories including a 'main' subdirectory
module Jekyll
class ImageListGenerator < Generator
def generate(site)
imagemap = {}
imagearr = []
dir = ""
#create a dir and image map
Dir.glob(File.join(site.source,'_images/**/*')).each {|f|
if File.directory?(f) then
@vegetableman
vegetableman / liquid_contains
Last active August 29, 2015 13:58
liquid template - contains, assign, split, append, forloop.index0
{% for img_dir in site.imagemap %}
{% if img_dir.size > 0 %}
{% assign img_category_arr = (img_dir[0] | split: '-') %}
{% assign img_category = img_category_arr[1] %}
{% for img_item in img_dir[1]%}
{% if img_item contains 'main' %}
{% assign img_path = (img_dir[0]|append: '/'|append: img_item) %}
{% picture {{img_path}} data-category="{{img_category}}" data-index="{{forloop.index0}}" %}
{% endif %}
{% endfor %}
@vegetableman
vegetableman / gist:e9ed4df769c49343af84
Created May 13, 2014 18:02
Scroll Cloaking on reactjs
/**
* @jsx React.DOM
*/
// Parent
var React = require('react'),
BlockItemView = require('./BlockItemView.jsx');
module.exports = BlockView = React.createClass({displayName: 'BlockView',
#### `Always open requests in new tab` option = **ON**
Tabs opened                  | Tab focus                  | I want to open a ...             | Click<br/>(Current behavior)                           | Double-Click<br/>(Current behavior)                           | Cmd/Ctrl+Shift+Click<br/>(Current behavior)                           | Click<br/>(Expected behavior)                           | Double-Click<br/>(Expected behavior)                           | Cmd/Ctrl+Shift+Click<br/>(Expected behavior)                          
--- | --- | --- | --- | --- | --- | --- | --- | ---
New Tab (blank) | New Tab (blank) | Saved request | Replaces the blank tab | Replaces the blank tab and opens a second tab **[BUG]** | Opens a second tab with the saved request | Replaces the blank tab | Replaces the blank tab | Opens a second tab with the saved request
New Tab (dirty) | New Tab (dirty) | Saved request | Replaces the unsaved tab losing all the work without any warning **[BUG]** | Replaces the unsaved tab losing a