Skip to content

Instantly share code, notes, and snippets.

@avil13
avil13 / 0_reuse_code.js
Last active August 29, 2015 14:05
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
@avil13
avil13 / fancyAlert.js
Last active August 29, 2015 14:05
fancy alert
function fancyAlert(msg) {
jQuery.fancybox({
'modal' : true,
'content' : "<div style=\"margin:1px;width:240px;\">"+msg+"<div style=\"text-align:right;margin-top:10px;\"><input style=\"margin:3px;padding:0px;\" type=\"button\" onclick=\"jQuery.fancybox.close();\" value=\"Ok\"></div></div>"
});
}
function fancyConfirm(msg,callback) {
var ret;
jQuery.fancybox({
@avil13
avil13 / myCookie.js
Last active December 27, 2017 15:59
JavaScript cookie function
/**
* myCookie('test', 123123) // set cookie
* myCookie('test') // get cookie
* myCookie('test', false) // delete cookie
*/
function myCookie(name, value) {
name = encodeURIComponent(name);
if (value === undefined) {
  1. Open Terminal move to your home folder: cd ~

  2. Enable git colors: git config --global color.ui true

  3. Make a file called ".colors": touch .colors

  4. Open .colors and paste the following:

@avil13
avil13 / jdecoder json decode
Created September 1, 2013 20:38
PHP jdecoder
<?php
function jdecoder($json_str) {
$cyr_chars = array (
'\u0430' => 'а', '\u0410' => 'А',
'\u0431' => 'б', '\u0411' => 'Б',
'\u0432' => 'в', '\u0412' => 'В',
'\u0433' => 'г', '\u0413' => 'Г',
'\u0434' => 'д', '\u0414' => 'Д',
'\u0435' => 'е', '\u0415' => 'Е',