Skip to content

Instantly share code, notes, and snippets.

@zhukov
zhukov / regex.md
Created June 28, 2016 16:16
Some RegExp to migrate to standard.js `single declaration per var` rule

In Sublime Text, "Find in folder" on folder with code

  1. (var [^;]+?),\s*([a-z0-9]+? =) => \1; var \2

  2. (for \(var [^);]+); var => \1, \2

  3. (var [^()]+),\n? (\S+(\n|$|,)) => \1; var \2

Repeat each up to 10 times.

@zhukov
zhukov / gist:1934001
Created February 28, 2012 17:58
VK compose photos
public void processThumbs(int maxW, int maxH){
ArrayList<ThumbAttachment> thumbs=new ArrayList<ThumbAttachment>();
for(Attachment att:attachments)
if(att instanceof PhotoAttachment) thumbs.add((ThumbAttachment)att);
String orients="";
int[] orients_cnt=new int[3];
ArrayList<Float> ratios=new ArrayList<Float>();
int cnt=thumbs.size();
boolean bad=false;