Skip to content

Instantly share code, notes, and snippets.

@oak-tree
oak-tree / css min issue
Created January 6, 2016 14:08
css min issue
cssmin:
{ dist: { files: { '<%= yeoman.dist %>/styles/main.css': [ '.tmp/styles/{,*/}*.css', 'source/styles/{,*/}*.css' ] } },
generated:
{ files:
[ { dest: 'www\\styles\\css\\main.css',
src: [ '.tmp\\concat\\styles\\css\\main.css' ] } ] } }
Running "concat:generated" (concat) task
Verifying property concat.generated exists in config...OK
Files: source/styles/css/reset.css, source/styles/css/index.css, source/styles/css/centure.css, source/styles/css/layout.css, source/styles/css/wizard.css, source/styles/css/hagderMenu.css, source/styles/css/header.css, source/styles/css/box.css, source/styles/css/footer.css, source/styles/css/overlay.css, source/bower_components/backgrid/lib/backgrid.css, source/bower_components/backgrid-paginator/backgrid-paginator.css, source/bower_components/backgrid-filter/backgrid-filter.css, source/styles/css/about.css, source/styles/css/grid.css, source/styles/css/photos.css, source/styles/css/editor.css, source/styles/css/colors.css -> .tmp\concat\styles\css
@oak-tree
oak-tree / .gitconfig
Last active December 14, 2015 10:09
pretty print for git log
##BASED on http://blog.kfish.org/2010/04/git-lola.html
## more on git log parameters http://git-scm.com/docs/pretty-formats
[alias]
#lol = log --graph --decorate --pretty=oneline --abbrev-commit
lol = log --graph --decorate --pretty=format:'%C(auto) %h %D %s - author: %Cblue %an' --abbrev-commit
#lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
lola = log --graph --decorate --pretty=format:'%C(auto) %h %D %s - author: %Cblue %an' --abbrev-commit --all
##credit to on https://plus.google.com/u/0/107195974066798722742
logm = log --decorate=short --pretty=format:'%C(yellow) %h %C(blue) %s %C(reset)(%C(red)by %cN %C(green)on %cD%C(reset))' --merges
@oak-tree
oak-tree / RUN_CAFFE_ON_DOCKER.md
Last active November 27, 2015 07:46
Run caffe on docker on windows

Docker

Install docker

Run docker

(cd /c/Program\ Files/Docker\ Toolbox/ ; ./start.sh)

Connect to docker container

run docker ps

run docker attach <containername|hash>

@oak-tree
oak-tree / scaleToContent
Created November 3, 2015 19:29
playing with scaling webpage to zoom by injecting js code to it
var resetMetaTag = function(){
metaTag = document.getElementsByName('viewport')
console.log('removing existing meta tag if any if none exist then create one')
console.log(metaTag.length)
if(metaTag.length > 0 ) {
metaTag[0].remove();
console.log('removing existing meta tag if any')
} else {
@oak-tree
oak-tree / part8.m
Created September 6, 2015 13:49
part8_net
net_arch = {...
struct('type','input','inInd',0,'outInd',1,'blobSize',[H,W,B,batch_size],'fName',train_images_file,'scale',1/256,'dataType','uint8'), ...
struct('type','input','inInd',0,'outInd',2,'blobSize',[k,batch_size],'fName',train_labels_file,'scale',1,'dataType','uint8'), ...
...
struct('type','conv','inInd',1,'outInd',3,'kernelsize',conv_kernel,'stride',conv_stride,'nOutChannels',conv_channels1,'bias_filler',0),...
struct('type','relu','inInd',3,'outInd',3), ...
struct('type','maxpool','inInd',3,'outInd',4,'kernelsize',pool_kernel,'stride',pool_stride), ...
...
struct('type','conv','inInd',4,'outInd',5,'kernelsize',conv_kernel,'stride',conv_stride,'nOutChannels',conv_channels2,'bias_filler',0),...
struct('type','relu','inInd',5,'outInd',5), ...
@oak-tree
oak-tree / fixMapingGridToPreview
Last active August 29, 2015 14:20
mapping grid to preview
//new idea to calculate instead of the *FIRST setRectToRect & Translation*
//note 1: We do not want to resize the grid - the grid window in his original size
//note 2: We acully just want to move the grid from his left top corner to the center of the preivew
//note 3: The **SECOND** setRectToRect should be keept because this is the mapping between the *preview* and the *real image*
Bitmap bitmapPicture = BitmapFactory.decodeByteArray(data, INT_START, data.length);
RectF previewRect = new RectF(0, 0, previewWidth, previewHeight);
RectF pictureRect = new RectF(0, 0, bitmapPicture.getWidth(), bitmapPicture.getHeight());
//RectF nativeResRect = new RectF(0, 0, screenWidth, screenHeight); // we actully dont care about the native res because we have the grid coordiantes
RectF resultRect = new RectF(0, gridTop, gridRight, gridBottom);
final Matrix scaleMatrix = new Matrix();
@oak-tree
oak-tree / pom.xml
Last active August 29, 2015 14:19
pom.xml
<env>production</env>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.core.version>4.0.6.RELEASE</spring.core.version>
<spring.security.core.version>3.2.4.RELEASE</spring.security.core.version>
<spring.data.jpa.version>1.6.2.RELEASE</spring.data.jpa.version>
<spring.test.version>4.0.6.RELEASE</spring.test.version>
<cglib.version>3.1</cglib.version>
<org.javassist.version>3.18.2-GA</org.javassist.version>
<aspectj.version>1.8.1</aspectj.version>
@oak-tree
oak-tree / term filter
Created April 15, 2015 08:17
mysql key,value query with multiply keys
SELECT term_id,count(name) as counter FROM `tbl_term_character`
WHERE
(name="Size" && (value & b'10'))
||
(name="HeadColors" && (value & b'110'))
group by term_id
having counter = 2
@oak-tree
oak-tree / markAllBackgrounds
Last active August 29, 2015 14:14
mark all border in page
//add javascript line into your bookmark and click on a page
//known bug: if jquery is not loaded this will only work on the 2nd click
javascript: (function() { if (!window.jQuery) { var script = document.createElement('script'); script.src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js";
document.body.appendChild(script); } if (window.markAllElementsBackground) { $('*').each(function() { $(this).css('background-color',$(this).data('save-background-color-data')) }); window.markAllElementsBackground = false; } else { $('*').each(function() { $(this).data('save-background-color-data', $(this).css('background-color')); var color = "#" + Math.floor(Math.random() * 0xFFFFFF).toString(16);$(this).css('background-color', color )}); window.markAllElementsBackground = true ; }})();
@oak-tree
oak-tree / gist:872010e8d29e59e9cb42
Last active August 29, 2015 14:14
Android crop image - psudo code
PictureCallback myPictureCallback_JPG = new PictureCallback(){
@Override
public void onPictureTaken(byte[] data, Camera arg1) {
// TODO Auto-generated method stub
try {
private final INT_QUALITY = 2;
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = INT_QUALITY;