Skip to content

Instantly share code, notes, and snippets.

@turgay
turgay / override_input.py
Created October 4, 2015 11:44
Python override builtin input function
import __builtin__
def fake_input(prompt):
print prompt
return "trgy"
__builtin__.raw_input = fake_input
name = raw_input("Enter your name >")
@turgay
turgay / SplitByCamelCase.groovy
Created July 21, 2015 15:23
Split camel case strings from file into words
new File("camelcase.txt").eachLine { line->
def tokens = line.split("(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])")
def words = []
tokens.each {
words.push(it.capitalize())
}
println words.join(" ")
@turgay
turgay / app.coffee
Last active August 29, 2015 14:14 — forked from ericallam/app.coffee
event = require('pilot/event')
Anchor = require('ace/anchor').Anchor
doc = ace_editor.session.getDocument()
editablePositions = [[1, 0, 2, 0]] # allow editong only the second row
jQuery.each editable, (index, row) ->
editablePositions.push [new Anchor(doc, row[0], row[1]), new Anchor(doc, row[2], row[3])]
Range = require('ace/range').Range