Skip to content

Instantly share code, notes, and snippets.

@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))
@evenchange4
evenchange4 / Colorful_Terminal .md
Last active October 14, 2015 01:37
Colorful Terminal

漂漂終端機懶人包

Mac iTerm2 截圖

[Mac] vi ~/.bash_profile 加入以下幾行

# Change prompt
PS1_OLD=${PS1}
export PS1="[\[\033[0;32m\]\w\[\033[0m\]] $ "
#enables color in the terminal bash shell
#!/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 }
@evenchange4
evenchange4 / callback.js
Last active December 11, 2015 15:19
callback function
function invoke_and_add(a,b){
return a()+b();
}
function one(){
return 1;
}
function two(){
return 2;
/**
Handle multiple socket connections with select and fd_set on Linux
Silver Moon ( m00n.silv3r@gmail.com)
*/
#include <stdio.h>
#include <string.h> //strlen
#include <stdlib.h>
#include <errno.h>
@evenchange4
evenchange4 / A.cpp
Last active December 27, 2015 20:18
Exception
// Class "MyException"
class MyException: public exception
{
...
};
// Class "A"
class A
{
public:

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