Skip to content

Instantly share code, notes, and snippets.

View sio4's full-sized avatar
😱
Panic again

Yonghwan SO sio4

😱
Panic again
View GitHub Profile
@sio4
sio4 / app_logger.rb
Created October 5, 2014 14:58
custom application log for rails app.
# lib/app_logger.rb
# vim: set ts=2 sw=2 expandtab:
class AppLogger < Logger
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
end
end
LOGGER = AppLogger.new('log/application.log', 'weekly')
@sio4
sio4 / outlook-macro-save-msg.vb
Last active August 29, 2015 14:08
MS Outlook Macro for saving message(s) by single click.
Option Explicit
Public Sub SaveMessageAsMsg()
Dim oMail As Outlook.MailItem
Dim objItem As Object
Dim sPath As String
Dim dtDate As Date
Dim sName As String
Dim sSender As String
Dim enviro As String
@sio4
sio4 / outlook-macro-forward.vb
Last active August 29, 2015 14:08
MS Outlook Macro for forwarding message to me by single click.
Public Sub ResendToMe()
Dim oMail As Outlook.MailItem
Dim objItem As Object
Dim addr As String
addr = Application.GetNamespace("MAPI").Accounts.Item(1).SmtpAddress
For Each objItem In ActiveExplorer.Selection
Set oMail = objItem.Forward
oMail.Subject = "Delayed - " + oMail.Subject
@sio4
sio4 / gitle-new-repo.sh
Created December 17, 2014 02:06
HTTP 서비스용 Git 저장소 만들기
#!/bin/bash
umask 002
repo=$1
repo_base=/var/git
[ "$repo" = "" ] && { echo "usage: $0 new_repo_name"; exit; }
git --bare init $repo_base/$repo.git && \
cd $repo_base/$repo.git && \
server {
...
# git via nginx ------------------------------------------------------
location ~ /git(/.*) {
auth_basic "";
auth_basic_user_file /var/git/.htpasswd;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /var/git;
###
# Namespace
###
Semantic = window.Semantic = Ember.Namespace.create
UI_DEBUG: false
UI_PERFORMANCE: false
UI_VERBOSE: false
###
# Mixin
@sio4
sio4 / softlayer-api-test.rb
Created July 3, 2015 05:07
SoftLayer API Test (Ruby)
#!/usr/bin/env ruby
require 'softlayer_api'
USER = "@@USERNAME@@"
API_KEY = "@@API_KEY@@"
client = SoftLayer::Client.new(username: USER, api_key: API_KEY)
puts client.to_json
@sio4
sio4 / authenticated_rest_adapter.js
Created December 10, 2015 03:00 — forked from marcoow/authenticated_rest_adapter.js
custom REST adapter for ember-data that sends the authentication token in a header
App.AuthenticatedRESTAdapter = DS.RESTAdapter.extend({
ajax: function(url, type, hash) {
hash = hash || {};
hash.headers = hash.headers || {};
hash.headers['X-AUTHENTICATION-TOKEN'] = this.authToken;
return this._super(url, type, hash);
}
});
@sio4
sio4 / resize_nocrop_noscale
Created March 27, 2016 16:11 — forked from maxivak/resize_nocrop_noscale
Crop and resize an image using MiniMagick in Ruby on Rails. Two approaches.
def resize_nocrop_noscale(image, w,h)
w_original = image[:width].to_f
h_original = image[:height].to_f
if w_original < w && h_original < h
return image
end
# resize
image.resize("#{w}x#{h}")
@sio4
sio4 / swagger12.json
Last active March 6, 2019 05:14
Swagger 1.2 example
{
"apiVersion": "1.0.0",
"swaggerVersion": "1.2",
"basePath": "http://petstore.swagger.wordnik.com/api",
"resourcePath": "/store",
"produces": [
"application/json"
],
"authorizations": {},
"apis": [