Skip to content

Instantly share code, notes, and snippets.

View lushchick's full-sized avatar
:octocat:

Andrii Lushchyk lushchick

:octocat:
View GitHub Profile
@lushchick
lushchick / gist:1170368
Created August 25, 2011 10:08
Get facebook user ids from sent requests callback using batch requests
FB.ui(
{
method: 'apprequests',
title: SP.copy._('js_invite_title'),
message: SP.copy._('js_invite_message')
},
function(response){
if (!FB.Dialog._stack.length) $('#sp_overlay').hide();
if (!response) return;
var batchStack = [],
@lushchick
lushchick / mobile_ua_regexp
Created May 10, 2012 14:20
Test Mobile UA
'/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|sagem|sharp|sie-|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i'
@lushchick
lushchick / gist:2708487
Created May 16, 2012 07:55
Bash tricks
#!/bin/bash
# Rename multiple files
for i in *.html; do mv $i ${i%.*}.tpl; done;
# Create file of specified size (1G)
dd if=/dev/zero of=sparse_file bs=1073741824 skip=1073741824 count=1
# Resample images so height and width aren't greater than specified size. Save in thumbnails folder
for i in Photo*.jpg; do sips -Z 100 $i --out thumbnails/${i%.*}_thumb.${i##*.}; done
@lushchick
lushchick / 1.js
Last active December 14, 2015 02:49 — forked from padolsey/1.js
var x = '/x/';
/x/==x
var origBind = rivets.binders['each-*'].bind,
col = { attr: 'data-col', idx: 0 },
dataKey = 'rivetsEachData';
/**
* Patch bind method to auto-refresh re-bound data
*
* @todo: remove it when this is fixed in Rivets:
* https://github.com/mikeric/rivets/issues/118
*
* @param el