Skip to content

Instantly share code, notes, and snippets.

View set_caret_position.js
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);
View jsbin.sodav.css
body {
font-family: arial;
}
View hello.rs
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"]))
});
}
View class_macros.rb
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 Dec 3, 2011
Line by line input for how I got SiriProxy running on a fresh install of Ubuntu 11.10
View gist:1428474
#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 Mar 7, 2011
a setup of Sinatra using Slim for HTML, Sass for CSS, and CoffeeScript for JavaScript
View sinatra_sass_coffee.rb
#!/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 Oct 23, 2020
Unicode kaomoji smileys emoticons emoji
View Has weird right-to-left characters.txt
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
You can’t perform that action at this time.