Skip to content

Instantly share code, notes, and snippets.

# Everything you need to do to get started with Rails 2.3.8
#
# As of June 14th, 2010 @ 2:30 p.m. MST
#
# This gist now features instructions to get Rails 3 up and running with:
# - Ruby 1.8.7-p174
# - Bundler 0.9.26
# - Cucumber 0.8.0
# - Rspec 1.3.0 + Rspec-Rails 1.3.2
# - RVM
-module(slugs).
-export([slugify/1]).
-define(tolower(C), (C+32)).
-define(islower(C), (C >= $a andalso C =< $z)).
-define(isupper(C), (C >= $A andalso C =< $Z)).
-define(isdigit(C), (C >= $1 andalso C =< $9)).
-define(isspace(C), (
C =:= $\s orelse C =:= $\n orelse C =:= $\t orelse C =:= $\r
## MAC OS
.DS_Store
## TEXTMATE
*.tmproj
tmtags
## EMACS
*~
\#*
Building native extensions. This could take a while...
ERROR: Error installing memprof:
ERROR: Failed to build gem native extension.
/home/kavu/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby extconf.rb
checking for main() in -lyajl_ext... yes
checking for json/json_gen.h... yes
checking for gelf_getshdr() in -lelf_ext... yes
checking for main() in -ldwarf_ext... yes
checking for mach-o/dyld.h... no
@kavu
kavu / main.c
Created January 26, 2011 14:25
#include <stdio.h>
#include <string.h>
#include <ctype.h>
static char buf[] = "the world helorow";
static void revstr(char *start, char *end) {
register char temp;
while(start < end) {
temp = *start;
@kavu
kavu / jshint_spec.js
Created February 20, 2011 10:40
Jasmine + JSLint
/*
Original code:
https://github.com/brandon/lucid/blob/master/spec/javascripts/z_jshint_spec.js
*/
describe('JSHint', function () {
var options = {curly: true, white: true, indent: 2},
files = /^\/src|.*spec\.js$/;
function get(path) {
@kavu
kavu / gist:1023207
Created June 13, 2011 17:13
Net::HTTP::Patch
require 'net/http'
require 'json'
class Net::HTTP::Patch < Net::HTTPRequest
METHOD = 'PATCH'
REQUEST_HAS_BODY = true
RESPONSE_HAS_BODY = true
end
url = URI.parse('https://api.github.com/user')
// ПоПацански.cpp : Defines the entry point for the console application.
//
// #include "stdafx.h"
#define подъёбку setlocale
#define чуть_чуть 7
#define так_себе 12
#define пошло_оно_всё 120
@kavu
kavu / google_speech_recognition.rb
Created December 11, 2011 13:05 — forked from pachacamac/google_speech_recognition.rb
google speech recognition with ruby
require 'rest_client'
require 'json'
a = `sox -d --norm -t .flac - silence -l 1 0 1% 1 6.0 1% rate 16k`
#a = `arecord -q -d 3 -c 1 -f S16_LE -r 22050 -t wav | flac - -f --totally-silent -o-`
r = RestClient.post 'https://www.google.com/speech-api/v1/recognize?lang=en-US', a,
:content_type => 'audio/x-flac; rate=16000'
(p j; `espeak 'you said: #{j['hypotheses'].first['utterance']}'`) if (j = JSON.parse(r))
@kavu
kavu / class-exp.hs
Created January 18, 2012 12:17
Haskell class experiments
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances, IncoherentInstances #-}
class (MyClass t) where
doShow :: (Show t) => t -> String
instance (MyClass String) where
doShow x = "Your string is " ++ x
instance (MyClass t) where
doShow x = "Your parameter is " ++ show x
instance (MyClass [t]) where
doShow x = do