Skip to content

Instantly share code, notes, and snippets.

var range = document.createRange();//Create a range (a range is a like the selection but invisible)
range.selectNodeContents(this.target);//Select the entire contents of the element with the range
range.setEnd(this.target.firstChild, pos);
range.collapse();//collapse the range to the end point. false means collapse to end rather than the start
selection = window.getSelection();//get the selection object (allows you to change selection)
selection.removeAllRanges();//remove any selections already made
selection.addRange(range);
@steveclarke
steveclarke / jsbin.sodav.css
Created February 12, 2014 00:07
Company / Jobs
body {
font-family: arial;
}
@wycats
wycats / hello.rs
Last active January 3, 2016 00:08
fn main() {
do RoutedServer::serve |config, router| {
config.listen("127.0.0.1", 1337);
router.get("/hello", |_,res| res.write("hello world"));
router.get("/posts/:id", |req,res| {
res.write(format!("post {}", req.params["id"]))
});
}
class Foo
def self.foo(method)
define_method(method) do
puts "Foo##{method} called."
end
end
foo :bar
foo :baz
end
@plamoni
plamoni / gist:1428474
Created December 3, 2011 23:19
Line by line input for how I got SiriProxy running on a fresh install of Ubuntu 11.10
#Here's what I did to get to the point where I'm at:
#-Install Ubuntu 11.10
#-Get all available updates
#-Add the VirtualBox add-ons and video driver
#-Set up SSH (for the SCP at the end)
#
# I have done nothing else to this virtual machine.
# On my iPhone, I set the DNS server to 192.168.2.131 (the IP of the virtual machine)
@jharjono
jharjono / sinatra_sass_coffee.rb
Created March 7, 2011 19:12
a setup of Sinatra using Slim for HTML, Sass for CSS, and CoffeeScript for JavaScript
#!/usr/bin/env ruby
# Libraries:::::::::::::::::::::::::::::::::::::::::::::::::::::::
require 'rubygems'
require 'sinatra/base'
require 'slim'
require 'sass'
require 'coffee-script'
# Application:::::::::::::::::::::::::::::::::::::::::::::::::::
@endolith
endolith / Has weird right-to-left characters.txt
Last active October 26, 2024 13:55
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶