Skip to content

Instantly share code, notes, and snippets.

@nikolazic
nikolazic / 0_reuse_code.js
Created November 20, 2013 17:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nikolazic
nikolazic / javascript_resources.md
Created November 20, 2013 17:03 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@nikolazic
nikolazic / mysql_grant.mysql
Last active December 28, 2015 21:49
MySQL Grant
GRANT ALL PRIVILEGES ON `lby`.* TO 'lby'@'%' IDENTIFIED BY 'pass plaintext';
OR
GRANT USAGE ON *.* TO 'user'@'%' IDENTIFIED BY PASSWORD 'PASS HASH';
@nikolazic
nikolazic / mysql_dump.sh
Created November 20, 2013 22:14
MySQL Dump
mysqldump --single-transaction <dbname> | sed -E 's/DEFINER=`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' | bzip2 > <dbname>-`date +%Y%m%d`.sql.bz2
@nikolazic
nikolazic / get_magento_urls.sql
Last active December 29, 2015 03:09
Get Magento URLs
# Find out what the old URL is
select * from core_config_data where path like 'web/%secure/base_%' or path = 'admin/url/custom' order by path;
# Replace
update core_config_data set value = replace(value, '://OLD', '://NEW') where path like '%web/%secure/base_url%';
@nikolazic
nikolazic / fast-file-delete-in-linux.sh
Created December 13, 2013 23:21
Fast file delete in Lilnux
mkdir empty
rsync -a --delete empty/ dir-to-delete
@nikolazic
nikolazic / windows_fast_delete.bat
Created December 13, 2013 23:22
Fast file delete in Windows
del /f/s/q foldername > nul
rmdir /s/q foldername
@nikolazic
nikolazic / mkdir_parent.sh
Created December 17, 2013 19:27
Make multiple (parent, recursive) directories
mkdir -p directory/path
@nikolazic
nikolazic / shell_csv_view_column.sh
Created January 13, 2014 20:24
Command line CSV viewer
column -s, -t < somefile.csv | less -#2 -N -S
@nikolazic
nikolazic / magento_shrink_websites.js
Created January 15, 2014 17:15
Shrink Magento Website Column for Sites with Many Websites
javascript:(function(){
var websiteColNumber = -1;
var websiteColName = 'Entries';
$$('tr.headings th').each(function(e, c) {
var o = $(e);
var h = o.innerHTML;
if(h.indexOf('Website') > 0 || h.indexOf('Store View') > 0 || h.indexOf('Visible In') > 0) {
websiteColNumber = c;
if(o.innerHTML.indexOf('Website') > 0) {
websiteColName = 'Websites';