Skip to content

Instantly share code, notes, and snippets.

@laomo
laomo / fetion.py
Created May 21, 2014 09:18
一个利用飞信给自己发消息的脚本
#-*-coding: utf-8 -*-
#!/usr/bin/python
import requests
def sendMsg(msg):
url_space_login = 'http://f.10086.cn/huc/user/space/login.do?m=submit&fr=space'
url_login = 'http://f.10086.cn/im/login/cklogin.action'
url_sendmsg = 'http://f.10086.cn/im/user/sendMsgToMyselfs.action'
parameter= { 'mobilenum':'yourmobile', 'password':'yourpassword'}
@jlongster
jlongster / touch.css
Created September 11, 2012 19:20
Web Audio API demo (iOS 6, Chrome) - The Web is a Platform
html, body {
background-color: black;
width: 100%;
height: 100%;
margin: 0;
}
canvas {
display: block;
margin: 0;
@keikubo
keikubo / README.md
Created March 20, 2012 01:38
Nginx + Unicorn for Rails on Rackhub

Nginx + Unicorn for Rails on Rackhub

Description:

This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.

Installation:

Please make sure that your Gemfile in your rails application includes unicorn.

@niw
niw / import_instapaper_to_redability.rb
Created March 7, 2012 11:58
A tiny script to import items from Instapaper to Readability
#!/usr/bin/env ruby
require 'csv'
require 'net/smtp'
require 'resolv'
# We need a specific version of eventmachine due to apply a patch.
gem 'eventmachine', '0.12.10'
require 'eventmachine'
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@samqiu
samqiu / railscasts.rb
Last active December 9, 2022 03:49
Download free Railscast video
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@jbjornson
jbjornson / open_filename_under_cursor.py
Created September 1, 2011 13:09
Open the filename from either the current selection or the clipboard. If neither of these are files, then create a new filename based on the selection.
import sublime, sublime_plugin
import os.path, string
VALID_FILENAME_CHARS = "-_.() %s%s%s" % (string.ascii_letters, string.digits, "/:\\")
# { "keys": ["alt+o"], "command": "open_filename_under_cursor" }
# https://gist.github.com/1186126
class OpenFilenameUnderCursor(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
@schleg
schleg / 01. Gemfile
Created May 26, 2011 17:26
Setup for Devise + Omniauth
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
@xuyuanme
xuyuanme / nginx.sh
Created February 26, 2011 01:42
Install Nginx and config Google ghs proxy
#!/bin/sh
# Install Nginx and config Google ghs proxy, tested on Amazon EC2 Linux
# You need first to add a domain A record point ghs to the server which runs Nginx
# and then alias sub-domain to ghs.your_domain_name
# Author: Yuan XU
# Version: 0.1
# URL: blog.xuyuan.me
if [ -z $1 ]; then
echo "Usage: nginx.sh [domain_name]"