Skip to content

Instantly share code, notes, and snippets.

@illnino
illnino / gist:2069513
Created March 18, 2012 07:08 — forked from padolsey/gist:527683
JavaScript: detect ie
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@illnino
illnino / dabblet.css
Created April 28, 2012 06:03 — forked from chriscoyier/dabblet.css
No space between inline-block
body {
font-family: sans-serif;
}
ul {
list-style: none
}
a{
text-decoration: none;
@illnino
illnino / jQuery
Created May 12, 2012 03:17
jQuery loaded
jQuery.fn.jquery
@illnino
illnino / Rails MongoMapper Template.rb
Created September 18, 2012 02:34 — forked from banker/Rails MongoMapper Template.rb
A Rails Template for using MongoMapper
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/gists/219223.txt
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
@illnino
illnino / flash-message.html.erb
Created November 5, 2012 03:12
Rails HTML5 Boilerplate
<% flash.each do |name, msg| %>
<% if msg.is_a?(String) %>
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
<a class="close" data-dismiss="alert">&#215;</a>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
</div>
<% end %>
<% end %>
@illnino
illnino / h5bp.html.erb
Created December 14, 2012 04:58
HTML5 Boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= content_for?(:title) ? yield(:title) : "RsgTwitterGem" %></title>
<%= csrf_meta_tags %>
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
@illnino
illnino / apply.html
Created December 18, 2012 06:23
http://net.tutsplus.com/tutorials/javascript-ajax/fully-understanding-the-this-keyword/ 1. 'this' in javascript, when to use that to store a reference of the object 2. 'call' 3. 'apply', the same as 'call'. except last param needs to be an array
<!DOCTYPE html><html lang="en"><body><script>
var myObject = {};
var myFunction = function(param1, param2) {
//setviacall()'this'points to my Object when function is invoked
this.foo = param1;
this.bar = param2;
console.log(this); //logs Object{foo = 'foo', bar = 'bar'}
};
myFunction.call(myObject, 'foo', 'bar'); // invoke function, set this value to myObject
console.log(myObject) // logs Object {foo = 'foo', bar = 'bar'}
@illnino
illnino / project.vb
Last active December 10, 2015 02:39
project
Sub ImportLargeFile(i As Integer)
'Imports text file into Excel workbook using ADO.
'If the number of records exceeds 65536 then it splits it over more than one sheet.
Dim strFilePath As String, strFilename As String, strFullPath As String
Dim lngCounter As Long
Dim oConn As Object, oRS As Object, oFSObj As Object
'Get a text file name
strFullPath = Application.GetOpenFilename("Text Files (*.txt),*.txt", , "Please selec text file...")
@illnino
illnino / CRecord.vb
Last active December 11, 2015 09:18
travel agent project
Option Explicit
Private mlRecordID As Long
Private mlParentPtr As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(dest As Any, Source As Any, ByVal bytes As Long)
Private msDte As String
Private msClient As String
Private msName As String
@illnino
illnino / 2.vb
Created March 24, 2013 15:07
Split according to contents in a column
'将单元格区域插入到一个表的最后
Sub AddRow(sht As Worksheet, rg As Range)
Dim shtrn As Integer
Dim rn, cn As Integer
shtrn = sht.Range("A1").CurrentRegion.Rows.Count
rn = rg.Rows.Count
cn = rg.Columns.Count
rg.Copy sht.Range("A1").Offset(shtrn, 0).Resize(rn, cn)
End Sub