Skip to content

Instantly share code, notes, and snippets.

View hitautodestruct's full-sized avatar

Yotam hitautodestruct

View GitHub Profile
@hitautodestruct
hitautodestruct / mysql-dump.sh
Last active August 12, 2019 06:34
An example of exporting an sql db from mysql from a cli
# export dump
mysqldump -u [username] -p[password] [dbname] | gzip > ~/[dbname].sql.gz
# import
mysql -u username -p database_name < file.sql
@hitautodestruct
hitautodestruct / directionless.scss
Last active March 2, 2016 10:11
mixins for supporting direction independent scss
@mixin ltr (){
@content;
}
@mixin rtl (){
.rtl & { @content; }
}
@mixin direction-start ($param, $value) {
@include ltr { #{$param}-left: $value; }
@hitautodestruct
hitautodestruct / storage.js
Created November 15, 2015 12:03
AngularJS service for getting and setting data
app.factory('storage', function() {
var store = {}
function set(key, data) {
store = data;
localStorage.setItem( key, JSON.stringify( data ) );
}
function get( key ) {
@hitautodestruct
hitautodestruct / curry-with-jscookie.html
Last active August 22, 2017 18:50
Allow usage of curry with js-cookie plugin
<script src="curry.min.js"></script>
<script src="js.cookie.js"></script>
<script>
var savedRate, savedCurrency;
var customCurrency = {
'USD': 1,
'COP': 2670,
};
@hitautodestruct
hitautodestruct / zip.md
Last active September 12, 2018 16:58
Zip files on osX without Icon or DS_Store

Terminal command to zip up files excluding unwanted Icon and DS_Store files

zip my_zip_file.zip -r dir_to_zip -x "*Icon*" "*.DS_Store"

A good "ready-to-use tool" option could be http-server:

npm install http-server -g

To use it:

cd D:\Folder
http-server

Or, like this:

@hitautodestruct
hitautodestruct / conf.md
Last active August 29, 2015 14:18
How to configure MAMP on OSX to allow for vHosts file and multiple domains
  1. Open up httpd.conf (/Applications/MAMP/conf/apache/httpd.conf)

  2. Uncomment the line under Virtual Hosts:

    Looks like this:

    # Virtual hosts
    #Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
    

    Should look like this:

@hitautodestruct
hitautodestruct / vhosts.conf
Created March 25, 2015 11:35
Definition for apache virtual host dev setup.
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Users/username/code/wp"
ServerName wp.website.com
ServerAlias wp.website.com
ServerAlias wp-website.*.xip.io
ErrorLog "logs/error_log_website.log"
<Directory "/Users/username/code/wp/">
Options Indexes FollowSymLinks Includes
AllowOverride All
@hitautodestruct
hitautodestruct / SassMeister-input.sass
Created March 10, 2015 11:49
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
=language
$language: "Greek"
.Greek &
@content
@hitautodestruct
hitautodestruct / regex-explanation.md
Last active August 29, 2015 14:14
Great explanation of Regex taken from this site http://webcheatsheet.com/php/regular_expressions.php

Using Regular Expressions with PHP

Regular expressions are a powerful tool for examining and modifying text. Regular expressions themselves, with a general pattern notation almost like a mini programming language, allow you to describe and parse text. They enable you to search for patterns within a string, extracting matches flexibly and precisely. However, you should note that because regular expressions are more powerful, they are also slower than the more basic string functions. You should only use regular expressions if you have a particular need.

This tutorial gives a brief overview of basic regular expression syntax and then considers the functions that PHP provides for working with regular expressions.

The Basics Matching Patterns Replacing Patterns Array Processing