Skip to content

Instantly share code, notes, and snippets.

View walm's full-sized avatar

Andreas Wålm walm

  • Sweden
View GitHub Profile
@walm
walm / _border_radius.sass
Created December 7, 2010 13:44
border_radius - top - bottom - all
@mixin border_radius($radius, $place=all)
@if $place == top
border-top-right-radius: $radius
border-top-left-radius: $radius
-moz-border-radius-topright: $radius
-moz-border-radius-topleft: $radius
-webkit-border-top-right-radius: $radius
-webkit-border-top-left-radius: $radius
@else if $place == bottom
border-bottom-right-radius: $radius
@walm
walm / window.console.js
Created December 10, 2010 08:11
Fix console for old shi*y browsers
if (!window.console) {
window.console = {
log: function() {},
error: function() {},
warn: function() {}
}
}
@walm
walm / less.vim
Created January 16, 2011 09:30 — forked from bryanjswift/less.vim
" Vim syntax file
" Language: LESS Cascading Style Sheets
" Maintainer: Leaf Corcoran <leafot@gmail.com>
" Modifier: Bryan J Swift <bryan@bryanjswift.com>
" URL: http://leafo.net/lessphp/vim/less.vim
" URL: http://gist.github.com/161047
" Last Change: 2009 August 4
" LESS by Leaf Corcoran
" CSS2 by Nikolai Weibull
" Full CSS2, HTML4 support by Yeti
@walm
walm / html5.vim
Created January 16, 2011 09:34 — forked from rcmachado/html5.vim
" Vim syntax file
" Language: HTML (version 5)
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
" URL: http://gist.github.com/256840
" Last Change: 2010 Aug 26
" License: Public domain
" (but let me know if you liked it :) )
"
" Note: This file just adds the new tags from HTML 5
" and don't replace default html.vim syntax file
@walm
walm / scriptpath.jquary.js
Created January 26, 2011 08:30
Get path from a js script based on name
function getScriptPath ( scriptName ) {
$('script').each(function () {
var src = $(this).attr('src');
if (typeof src == 'string' &&
src.indexOf(scriptName) != -1)
return src;
});
return null;
@walm
walm / gist:824556
Created February 13, 2011 09:12
jQuery on anypage
var j=document.createElement("SCRIPT");
j.src="http://code.jquery.com/jquery-latest.pack.js";
document.getElementsByTagName("HEAD")[0].appendChild(j);
@walm
walm / gist:825639
Created February 14, 2011 09:04
C# to json
Dictionary<string, string> jsonObj = new Dictionary<string, string>();
jsonObj.Add("id", "32");
jsonObj.Add("end_date", "2011-01-01");
jsonObj.Add("title", "A titel");
jsonObj.Add("message", "A message");
string json = new JavaScriptSerializer().Serialize(json);
@walm
walm / js-line-count.sh
Created February 28, 2011 08:23
Count lines of code in js files
find . -name '*.js' | xargs wc -l
@walm
walm / gist:881857
Created March 22, 2011 19:23
Gzip ASP.NET response
HttpContext context = HttpContext.Current;
context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress);
HttpContext.Current.Response.AppendHeader("Content-encoding", "gzip");
HttpContext.Current.Response.Cache.VaryByHeaders["Accept-encoding"] = true;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.811765 0.796078 0.564706 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Inconsolata - 16.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>1 1 1 1</string>