Skip to content

Instantly share code, notes, and snippets.

View wallymathieu's full-sized avatar

Oskar Gewalli wallymathieu

View GitHub Profile
@wallymathieu
wallymathieu / .gitignore
Last active August 29, 2015 14:17 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.3
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@wallymathieu
wallymathieu / BasicReport.js
Created May 28, 2015 09:24
Possible to style basic workbook, the documentation should perhaps be updated.
define(['../Excel/Workbook', '../Excel/Table'], function (Workbook, Table) {
var Template = function (worksheetConstructorSettings) {
this.workbook = new Workbook();
this.stylesheet = this.workbook.getStyleSheet();
this.columns = {};
this.predefinedStyles = {
};
@wallymathieu
wallymathieu / gist:db05ab8dd46e0de05c11
Last active August 29, 2015 14:28 — forked from coffeejunk/gist:3827905
ruby string for xml
In Ruby 1.9.2 to escape XML special characters in Strings, use the 'encode' method.
Example, if you have:
my_string = 'this is "my" complicated <String>'
For XML attributes use:
"<node attr=#{my_string.encode(:xml => :attr)} />"
Generates:
@wallymathieu
wallymathieu / rotated_smiley.rb
Created September 2, 2010 05:35
smiley noise image
#!/usr/bin/ruby -w
require "rubygems"
require 'RMagick'
Text = ':)'
granite = Magick::ImageList.new('plasma:fractal') {self.size = "128x128"}
canvas = Magick::ImageList.new
canvas.new_image(128, 128, Magick::TextureFill.new(granite))
#canvas.rotate(45)
@wallymathieu
wallymathieu / XElementDiff.cs
Created December 14, 2010 12:48
In order to test if two XElement are equal
namespace Something.utils
{
public class XElementDiff
{
public static void AssertEqual(XElement actual, XElement source)
{
ValuesAreEqual(actual, source);
TagsAreEqual(actual, source);
var actualElements = actual.Elements();
var sourceElements = source.Elements();
@wallymathieu
wallymathieu / convert_greek_to_utf8.cmd
Created February 9, 2011 18:29
Simple script to convert greek windows-1253 subtitles to UTF-8
@ECHO OFF
ruby convert_greek_to_utf8.rb "%~dpn0" %*
pause
@wallymathieu
wallymathieu / stitch.fsi
Created September 25, 2015 20:10
stitch
let r = [0;1;2;3]
let stitch s=
let head = s |> Seq.head
let tail = s |> Seq.skip 1
tail |> Seq.scan (fun state elem-> (snd state, elem)) (head, head)
|> Seq.skip 1
|> Seq.toList
open System.Linq
@wallymathieu
wallymathieu / generate_delicious_library_index.rb
Created May 25, 2011 21:45
Generate simple index for delicious library
require "rubygems"
require "nokogiri"
def getfiles(dir)
return Dir.new(dir).entries.select {|file| file =~ /[^.]*.html/ }
end
def replaceChars(str)
return str.gsub('å','&aring;').gsub('ä','&auml;').gsub('ö','&ouml;') \
.gsub('Å','&Aring;').gsub('Ä','&Auml;').gsub('Ö','&ouml;') \
desc "Check the JavaScript source with JSLint - exit with status 1 if any of the files fail."
task :jslint do
failed_files = []
classpath = File.join(RAILS_ROOT, "vendor", "rhino.jar")
jslint_path = File.join(RAILS_ROOT, "vendor", "jslint.js")
Dir['public/**/*.js'].reject{|path| path =~ /public\/ext\//}.each do |fname|
cmd = "java -cp #{classpath} org.mozilla.javascript.tools.shell.Main #{jslint_path} #{fname}"
results = %x{#{cmd}}
unless results =~ /^jslint: No problems found in/
puts "#{fname}:"
@wallymathieu
wallymathieu / 1.router.js
Created December 13, 2011 07:18 — forked from scottmessinger/1.router.js
Routing in KO with Backbone.js
App.Router = Backbone.Router.extend({
routes : {
"" : "home"
,"/" : "home"
,"!" : "home"
,"!/" : "home"
,"!/:username" : "show_user"
,":username" : "show_user"
,":username/" : "show_user"