Skip to content

Instantly share code, notes, and snippets.

View vaskaloidis's full-sized avatar

Vas Kaloidis vaskaloidis

View GitHub Profile
#!/bin/bash
branch_name=$(git branch | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/")
echo "Removing old cordova directory"
rm -rf cordova
echo "Creating cordova app to ${branch_name}..."
echo "WARNING: say 'no' to the next prompts"
ember generate cordova-init "my.company.${branch_name}" --platform=android
@oneup
oneup / what_i_used_from_rails.rb
Created July 18, 2009 05:34
useful rails cheatsheet
# Rails Cheat Sheet
# and list of helpers worth keeping
# command line
script/generate controller
# route
map.root :controller => "controller_name"
require 'net/http'
require 'rack'
# todo
# - detect ssl
# - keepalive?
module Rack
class Forwarder
def initialize(host, port=80)
<%@page import="com.liferay.portal.kernel.dao.search.RowChecker"%>
<%@include file="/html/actions/init.jsp"%>
<%
PortletURL portletURL = renderResponse.createRenderURL();
String portletURLString = portletURL.toString();
StudentSearchContainer studentSearchContainer = new StudentSearchContainer(renderRequest, portletURL);
StudentDisplayTerms displayTerms = (StudentDisplayTerms)studentSearchContainer.getDisplayTerms();
<%@page import="com.liferay.portal.kernel.dao.search.RowChecker"%>
<%@include file="/html/actions/init.jsp"%>
<%
PortletURL portletURL = renderResponse.createRenderURL();
String portletURLString = portletURL.toString();
StudentSearchContainer studentSearchContainer = new StudentSearchContainer(renderRequest, portletURL);
StudentDisplayTerms displayTerms = (StudentDisplayTerms)studentSearchContainer.getDisplayTerms();
@aarongustafson
aarongustafson / backup-to-git.sh
Created August 10, 2011 15:44
DB Backup to Git
#!/bin/bash
##
# MySQL DB dump to Git commit
#
# Dumps the specified mysql database to the given location and commits it and
# the previous database to the Git repository.
#
# It is assumed you have already setup the Git respository to only be the
# a checkout of the database backup location
@cmalven
cmalven / cheatsheet-layout-rendering-rails.md
Last active October 3, 2018 19:07
Cheat Sheet: Layouts and Rendering in Rails
@emk
emk / link_to.rb
Created April 20, 2009 01:21
A link_to helper method for Sinatra
require 'rubygems'
require 'net/ssh'
# Run this on the machine (node) which needs to tunnel out to forward the UI to the remote system (console)
Net::SSH.start("remote_host", "remote_user") do |ssh|
# since we are running sinatra locally we will forward 43210 on the remote_host to our localhost 4567
# This is effectively the same as:
# ssh -R 4567:localhost:43210 remote_user@remote_host
ssh.forward.remote(4567, "localhost", 43210)
ssh.loop { true }
@serverwentdown
serverwentdown / server.js
Last active January 29, 2019 20:18 — forked from mixonic/server.js
// Bug fixes for current versions.
//
// This server will start a bash shell and expose it
// over socket.io to a browser. See ./term.html for the
// client side.
//
// You should probably:
//
// npm install socket.io