Skip to content

Instantly share code, notes, and snippets.

@yoeun
yoeun / Log.cs
Created May 26, 2011 22:17
Write to browser Javascript console from Silverlight in most browsers. Works with code outside of UI thread.
// Credit: Kodierer http://bit.ly/pqcSq
using System;
using System.Threading;
using System.Windows;
using System.Windows.Browser;
using System.Windows.Threading;
public class Log
{
@yoeun
yoeun / form.html.haml
Created July 27, 2011 14:53
Rails 3 file upload (manual)
= form_for @photo, :html => { :multipart => true } do |f|
.field
= f.label :title
= f.text_field :title
- if !@photo.img_original.nil? and !@photo.img_original.empty?
%img{:src => "/uploads/#{@photo.img_original}", :border => 1, :width => 50, :height => 50 }
.field
= f.label 'New file'
@yoeun
yoeun / Gemfile
Created July 27, 2011 15:18
Setup Rails 3 for HAML, MySQL and Paperclip
gem 'mysql2', '< 0.3'
gem 'haml'
gem 'haml-rails'
gem 'paperclip', '~> 2.3'
@yoeun
yoeun / .gitignore
Created July 19, 2012 16:12
C# .gitignore file
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
bin
obj
# Visual Studio files
*.suo
_ReSharper.*
*.user
# mstest test results
@yoeun
yoeun / app.config.xml
Created August 14, 2012 21:05
NLog settings in app.config and web.config files
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="default" xsi:type="File"
fileName="C:\logs\app-log.txt"
archiveFileName="C:\logs\archives\app-log.{#}.txt"
@yoeun
yoeun / new.js
Created August 31, 2012 16:42
Vera recommendation json (without divorce)
{
recommendation:
{
planName:"Family Nation 1400",
features:[],
devices:
[
{ phoneNumber: "1234567890", features:[] },
{ phoneNumber: "4561234098", features:[] },
{ phoneNumber: "7891234567", features:[] }
@yoeun
yoeun / install-ruby-osx-10.8.md
Created December 15, 2012 20:51
How to install Ruby on OS X Mountain Lion (10.8)
@yoeun
yoeun / index.haml
Last active December 22, 2015 04:29
Basic HTML5 document
!!! 5
%html
%head
%meta{ :charset => "utf-8" }
%title= "Website"
%meta{ :name => "description", :content => "" }
%meta{ :name => "author", :content => "Yoeun Pen" }
%link{ :href => "css/main.css", :media => "screen", :rel => "stylesheet" }
%script{ :src => "js/modernizr.js" }
%body
@yoeun
yoeun / terminal_shortcuts.txt
Created December 19, 2013 02:15
OS X Terminal keyboard shortcuts
CTRL+a
Move cursor to beginning of the line. (I think of this as anchoring my cursor to the start.)
CTRL+e
Move cursor to the end of the line.
CTRL+k
Delete everything from under the cursor to the end of the line. (I think of this as killing the rest of my line.)
CTRL+f
@yoeun
yoeun / init_rb.sh
Last active January 4, 2016 21:39
Commans for new Ruby projects
cd projectname
rvm --rvmrc --create use ruby-x.x.x@projectname
bundle init # if applicable
vim Gemfile
bundle install