This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Queue() { | |
var self = this; | |
self.queue = []; | |
self.push = function (fn, context, params) { | |
params = params || []; | |
context = context || this; | |
self.queue.push({fn: fn, params: params, context: context}); | |
return self; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (canvas, container) { | |
var history = {state: [], lock: true, mods: 0}; | |
app.history = history; | |
canvas.on('history.lock', function () { | |
history.lock = true; | |
}); | |
canvas.on('history.unlock', function () { | |
history.lock = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Parallel() { | |
var self = this; | |
self.finished = 0; | |
self.length = 0; | |
self.list = []; | |
self.add = function (fn, context, params) { | |
params = params || []; | |
context = context || this; | |
self.list.push({fn: fn, params: params, context: context}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db-create: | |
mysql -u user -p -e 'CREATE SCHEMA `db-name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;' | |
db-update: | |
php yii modules-migrate | |
message: | |
php yii message src/messages/config.php | |
vendors-update: | |
composer update | |
vendors-install: | |
composer install -o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mount /dev/sdaX /mnt # Make "X" the partition that has Ubuntu installed (i.e. /dev/sda2). | |
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt/$i"; done | |
sudo chroot /mnt | |
update-grub | |
if no errors skip this | |
grub-install /dev/sdX (x is the hard drive that has linux installed (i.e. /dev/sda) | |
update-grub Reboot the system |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.grayscale { | |
-webkit-filter: grayscale(100%); | |
-moz-filter: grayscale(100%); | |
-ms-filter: grayscale(100%); | |
-o-filter: grayscale(100%); | |
filter: grayscale(100%); | |
filter: gray; /* IE 6-9 */ | |
-webkit-transition: all 1s; | |
-moz-transition: all 1s; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Usage | |
<span id="permutable4" | |
onmouseenter="permute('permutable4')" | |
onmouseleave="unpermute('About','permutable4')" | |
onclick="unpermute('About','permutable4')"> | |
About | |
</span> | |
**/ | |
var ewig = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gulpfile only for postcss usage | |
* | |
* Good for WP | |
* | |
* Direcotry structure: | |
* -/ | |
* |-/post-css/ | |
* |- style.css | |
* |-/css/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void quickSort(int arr[], int left, int right) { | |
int i = left, j = right; | |
int tmp; | |
int pivot = arr[(left + right) / 2]; | |
/* partition */ | |
while (i <= j) { | |
while (arr[i] < pivot) | |
i++; | |
while (arr[j] > pivot) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int N = 10000000; | |
int lp[N+1]; | |
vector<int> pr; | |
for (int i=2; i<=N; ++i) { | |
if (lp[i] == 0) { | |
lp[i] = i; | |
pr.push_back (i); | |
} | |
for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j) |
OlderNewer