Skip to content

Instantly share code, notes, and snippets.

@marwan-nwh
marwan-nwh / last-style.js
Created October 26, 2012 15:24
get the last element on the dom by class and apply style to it
<script type="text/javascript">
c=document.getElementsByClassName("comment-inner");
last_element = c[c.length - 1];
last_element.style.borderBottomWidth="0";
</script>
public class IpCutter{
public static void main(String[] args){
int x;
int begin;
int end;
int count;
String ip;
x=0;
public class IpCutter2{
public static void main(String[] args){
String[] ip;
ip=args[0].split("\\.");
for(int i=0;i<ip.length;i++){
System.out.println(ip[i]);
}
}
import java.util.StringTokenizer;
import java.util.NoSuchElementException;
public class IpCutter3 {
public static void main (String[]args) {
StringTokenizer Q = new StringTokenizer(args[0]);
String[]k=new String[4];
try {
for (int i=0;i<4;i++)
k[i]=Q.nextToken(".");
}
ip= gets
p ip.split(".")
import java.util.Scanner;
public class ipreader {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("enter your ip");
String ip=s.next();
String newip="";
char ipChar;
for(int i=0;i<ip.length();i++)

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
def authenticate_with_email_and_password
passenger = Passenger.find_by_email(params[:email])
if passenger
if passenger.valid_password?(params[:password])
if passenger.confirmed?
passenger
else
render :json => {:result => "failure",:error => "not confirmed"}.to_json
return
end
<h2>Sign up</h2>
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :email, :required => true, :autofocus => true %>
<%= f.input :name %>
<%= f.input :password, :required => true %>
<%= f.input :password_confirmation, :required => true %>
@article_subbed = @article.body.gsub 'startcode', '<pre class="prettyprint">'
@article.body = @article_subbed.gsub 'endcode', '</pre>'