Skip to content

Instantly share code, notes, and snippets.

@evenchange4
evenchange4 / install-flow
Created September 24, 2012 07:09 — forked from andikan/install-flow
ec2 environment
http://ggd.github.com/blog/2012/07/20/deploy-rails-3-with-apache-mysql-passenger-capistrano-to-ec2/
http://nathanhoad.net/how-to-ruby-on-rails-ubuntu-apache-with-passenger
#ruby :
sudo apt-get install ruby1.9.1-full
#simple compiler
sudo apt-get install build-essential
#mysql
sudo apt-get install mysql-server mysql-common mysql-client libmysqlclient-dev
#ruby mysql adapter
@evenchange4
evenchange4 / Procfile
Created September 28, 2012 11:12 — forked from clarle/Procfile
Simultaneous Mojito deployment technique for Heroku and Nodejitsu
web: node server.js
class AbstractNode
@@root = nil
def initialize(n, keys, parent)
@slot = n
@keys = keys
@parent = parent
@@root = self unless @@root
end
@evenchange4
evenchange4 / converter.py
Created October 22, 2012 09:44 — forked from sodastsai/converter.py
Convert CSV to PLIST
#!/usr/bin/env python3
import sys
import csv
import plistlib
import os
csv_file = sys.argv[1]
with open(csv_file, 'r', encoding='utf-8') as f:
result = list(csv.DictReader(f))
@evenchange4
evenchange4 / converter.py
Created October 22, 2012 09:44 — forked from sodastsai/converter.py
Convert CSV to PLIST
#!/usr/bin/env python3
import sys
import csv
import plistlib
import os
csv_file = sys.argv[1]
with open(csv_file, 'r', encoding='utf-8') as f:
result = list(csv.DictReader(f))
#!/usr/bin/ruby
require 'rss'
p 'Downloading rss index'
rss_string = open('http://feeds.feedburner.com/railscasts').read
rss = RSS::Parser.parse(rss_string, false)
videos_urls = rss.items.map { |it| it.enclosure.url }.reverse
videos_filenames = videos_urls.map {|url| url.split('/').last }
/**
Handle multiple socket connections with select and fd_set on Linux
Silver Moon ( [email protected])
*/
#include <stdio.h>
#include <string.h> //strlen
#include <stdlib.h>
#include <errno.h>

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

/**
* A generic confirmation for risky actions.
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function
*/
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
uploader = $fileUploader.create(
scope: $scope
url: "http://#{$rootScope.api}/proposal/upload"
formData: [{
key: \value
}]
filters: [
(item) ->
if item.size >10000000
alert \size不得超過10mb