Skip to content

Instantly share code, notes, and snippets.

View danichim's full-sized avatar

Dan Ichim danichim

View GitHub Profile
#!/bin/bash
#Install files on a fresh OS
#Everything will be up to date
sudo apt-get update
sudo apt-get upgrade
#Stuff!
sudo apt-get install git zsh vim curl nodejs vim-nox
export TERM=xterm-256color
# Path to your oh-my-zsh installation.
ZSH=/usr/share/oh-my-zsh/
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#Create a new user account via FTP:
1. Open FTP client and connect to your account
2. Navigate to wp-content/themes
3. Open the folder of the theme you are using
4. Search for functions.php file and edit it
5. Copy and paste the following function:
function admin_account(){
$user = 'Username';
$pass = 'Password';
@danichim
danichim / js.html
Created March 17, 2017 15:15
Force link open in app
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
window.onload = function() {
[{ "name": "JavaScript", "year": "2012", "quarter": "2", "count": "29168" },
{ "name": "Ruby", "year": "2012", "quarter": "2", "count": "21053" },
{ "name": "Python", "year": "2012", "quarter": "2", "count": "20940" },
{ "name": "PHP", "year": "2012", "quarter": "2", "count": "13371" },
{ "name": "Java", "year": "2012", "quarter": "2", "count": "12817" },
{ "name": "C++", "year": "2012", "quarter": "2", "count": "10648" },
{ "name": "C", "year": "2012", "quarter": "2", "count": "5324" },
{ "name": "Objective-C", "year": "2012", "quarter": "2", "count": "3228" },
{ "name": "C#", "year": "2012", "quarter": "2", "count": "3216" },
{ "name": "XSLT", "year": "2012", "quarter": "2", "count": "1828" },
@danichim
danichim / locality-tnt.json
Created November 22, 2017 15:25
locality-tnt-json
This file has been truncated, but you can view the full file.
[
{"id":"2","country_id":"1","region1":"Bucure\u015fti - Ilfov","region2":"Bucure\u015fti","region3":"Sectorul 1","region4":null,"name":"Bucure\u015fti","region1_latin":"Bucuresti - Ilfov","region2_latin":"Bucuresti","region3_latin":"Sectorul 1","region4_latin":null,"name_latin":"Bucuresti","geoid":"1","iso2":"RO-B","lat":"44.436550","lng":"26.099350","zip":"10011","timezone":"Europe\/Bucharest","utc":"UTC+2","dst":"Y","status":"1","created":"2014-01-08 15:25:14","modified":"2016-09-22 08:10:38"},
{"id":"3","country_id":"1","region1":"Bucure\u015fti - Ilfov","region2":"Bucure\u015fti","region3":"Sectorul 2","region4":null,"name":"Bucure\u015fti","region1_latin":"Bucuresti - Ilfov","region2_latin":"Bucuresti","region3_latin":"Sectorul 2","region4_latin":null,"name_latin":"Bucuresti","geoid":"3115","iso2":"RO-B","lat":"44.450470","lng":"26.123220","zip":"20122","timezone":"Europe\/Bucharest","utc":"UTC+2","dst":"Y","status":"1","created":"2014-01-08 15:25:14","modified":"2016-09-22 08:10:38"},
{"id":"4","countr
@danichim
danichim / locality.json
Created April 2, 2018 14:20
LocalityJsonRomania
This file has been truncated, but you can view the full file.
[
{"id":"2","country_id":"1","region1":"Bucure\u015fti - Ilfov","region2":"Bucure\u015fti","region3":"Sectorul 1","region4":null,"name":"Bucure\u015fti","region1_latin":"Bucuresti - Ilfov","region2_latin":"Bucuresti","region3_latin":"Sectorul 1","region4_latin":null,"name_latin":"Bucuresti","geoid":"1","iso2":"RO-B","lat":"44.436550","lng":"26.099350","zip":"10011","timezone":"Europe\/Bucharest","utc":"UTC+2","dst":"Y","status":"1","created":"2014-01-08 15:25:14","modified":"2016-09-22 08:10:38"},
{"id":"3","country_id":"1","region1":"Bucure\u015fti - Ilfov","region2":"Bucure\u015fti","region3":"Sectorul 2","region4":null,"name":"Bucure\u015fti","region1_latin":"Bucuresti - Ilfov","region2_latin":"Bucuresti","region3_latin":"Sectorul 2","region4_latin":null,"name_latin":"Bucuresti","geoid":"3115","iso2":"RO-B","lat":"44.450470","lng":"26.123220","zip":"20122","timezone":"Europe\/Bucharest","utc":"UTC+2","dst":"Y","status":"1","created":"2014-01-08 15:25:14","modified":"2016-09-22 08:10:38"},
{"id":"4","countr
@danichim
danichim / gwqgq.js
Last active September 26, 2018 12:25
flipclock min
/*
Base.js, version 1.1a
Copyright 2006-2010, Dean Edwards
License: http://www.opensource.org/licenses/mit-license.php
*/
var Base = function() {
// dummy
};
@danichim
danichim / custom-functions.php
Last active October 30, 2018 09:24
shortcode To Show Or Hide Content
// Show or hide content based on whether user is logged in or not
// shortcode for logged in users is [loggedin]content[/loggedin]
// shortcode for logged out users us [loggedout]content[/loggedout]
function loggedincheck( $atts, $content = null ) {
$user = wp_get_current_user();
$allowed_roles = array('administrator', 'editor', 'author');
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() && array_intersect($allowed_roles, $user->roles ) ) {
return $content;
return '';
@danichim
danichim / functions.php
Created October 31, 2018 09:42
customer notify email on cancel order
add_action('woocommerce_order_status_changed', 'send_custom_email_notifications', 10, 4 );
function send_custom_email_notifications( $order_id, $old_status, $new_status, $order ){
if ( $new_status == 'cancelled' || $new_status == 'failed' ){
$wc_emails = WC()->mailer()->get_emails(); // Get all WC_emails objects instances
$customer_email = $order->get_billing_email(); // The customer email
}
if ( $new_status == 'cancelled' ) {
// change the recipient of this instance
$wc_emails['WC_Email_Cancelled_Order']->recipient = $customer_email;