Skip to content

Instantly share code, notes, and snippets.

View zetavg's full-sized avatar

Pokai Chang zetavg

View GitHub Profile
@zetavg
zetavg / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../core-tooltip/core-tooltip.html">
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
<p class="user-actions">
<% if current_user.blank? %>
<%= link_to("Sign In", new_user_session_path) %>
<%= link_to("Sign Up", new_user_registration_path) %>
<% else %>
Hello, <%= current_user.email %>
<%= link_to("Log Out", destroy_user_session_path, method: :delete) %>
<% end %>
</p>
<% flash.each do |type, message| %>
<p class="<%= type %>"><%= message %></p>
<% end %>
Programming Assignment #2                                   CS4001301
=====================================================================

1. Scheme (50pt)

	function name: inv_app
	input: 2 lists, list1 and list2
https://github.com/Neson/date-parser
https://raw.githubusercontent.com/Neson/date-parser/master/script/date-parser.min.js
dateParser.parse('')
https://github.com/karpathy/convnetjs
http://cs.stanford.edu/people/karpathy/convnetjs/demo/mnist.html
@zetavg
zetavg / codeship_rails_opsworks_deploy.sh
Last active August 29, 2015 14:14
The script used to deploy Rails apps to AWS OpsWorks via Codeship.
#!/bin/sh
#
# The script used to deploy Rails apps to AWS OpsWorks via Codeship.
#
# It requires the following environment variables to be set:
#
# - AWS_ACCESS_KEY_ID
# - AWS_SECRET_ACCESS_KEY
# - APP_NAME
# - S3_BUCKET
@zetavg
zetavg / set-app.sh
Last active August 29, 2015 14:14
`bin/rake` tasks and `bin/rails console` with ease on AWS OpsWorks Instances running Unicorn Rails App Server.
# $ curl -L http://git.io/opsru_setapp > set-app.sh
# $ . set-app.sh app_name
#
# cd into app directory and sets the environment variables
# on AWS OpsWorks Instances running Unicorn Rails App Server.
APP_NAME=$1 && \
cd "/srv/www/${APP_NAME}/current" && \
export RAILS_ENV=production && \
cat "/srv/www/${APP_NAME}/shared/config/unicorn.conf" | grep ENV > "/tmp/${APP_NAME}_env" && \
@zetavg
zetavg / swapon.sh
Last active February 19, 2016 16:52
在 VM 裡遇到 cannot allocate memory 的問題,打一下這個就解決了。sudo fallocate -l 2G /swapfile 的 2G 可以改成想要的大小。
cd /
sudo swapon -s
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
rm -rf ~/.bundle/ ~/.gem/bundler/ ~/.gems/cache/bundler/
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/
rm -rf .bundle/
rm -rf vendor/cache/
rvm gemset use global
gem uninstall rubygems-bundler open_gem
bundle install
@zetavg
zetavg / set-app.sh
Last active August 29, 2015 14:15
`bin/rake` tasks and `bin/rails console` with ease on AWS OpsWorks Instances running Passenger Rails App Server.
# $ curl -L http://git.io/opsrp_setapp > set-app.sh
# $ . set-app.sh app_name
#
# cd into app directory and sets the environment variables
# on AWS OpsWorks Instances running Passenger Rails App Server.
APP_NAME=$1 && \
cd "/srv/www/${APP_NAME}/current" && \
export RAILS_ENV=production && \
\