Skip to content

Instantly share code, notes, and snippets.

Avatar

Isaac Ben Hutta itzikbenh

View GitHub Profile
@BenBroide
BenBroide / setup-wp-twentyseventeen-child-plugins.sh
Last active Oct 10, 2017
Turn c9 WordPress workspace server "ON" and paste this bash code in the c9 ide terminal and click "enter"
View setup-wp-twentyseventeen-child-plugins.sh
#turn workspace server on ( "RUN" button), paste this into c9 terminal, and hit "enter"
SETUP_PATH="setup.sh"
cat >$SETUP_PATH <<'EOF'
#!/bin/bash
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp core install --url=https://$C9_HOSTNAME --title=QuickWP --admin_user=admin --admin_password=123456 --admin_email=$C9_EMAIL
wp option update my_option '{"site_url": "bar"}' --format=json
wp theme install twentyseventeen
@markerikson
markerikson / prepareActions.js
Created May 1, 2016
Redux prepareActions utility function
View prepareActions.js
import {bindActionCreators} from "redux";
import {connect} from "react-redux";
import {action1, action2} from "myActions";
// A reusable utility function that binds action creators
// and returns them as a prop named "actions"
function prepareActions(actions) {
return (dispatch) => ({
actions : bindActionCreators(actions, dispatch);
})
@telekosmos
telekosmos / uniq.js
Last active Oct 7, 2021
Remove duplicates from js array (ES5/ES6)
View uniq.js
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@jonaslejon
jonaslejon / Mailgun PHP API with curl
Last active Jul 31, 2021
Send mail with Mailgun API version 2 and PHP. Should also work with version 3 of the Mailgun API
View Mailgun PHP API with curl
define("DOMAIN", "test.se");
define("MAILGUN_API", "XXX123"); // Mailgun Private API Key
function br2nl($string) {
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
}
function mg_send($to, $subject, $message) {
$ch = curl_init();
@tobysteward
tobysteward / BlogController.php
Last active Jul 29, 2021
Laravel AJAX Pagination with JQuery
View BlogController.php
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()
@2called-chaos
2called-chaos / install_nginx_vim.sh
Created Mar 3, 2013
enable nginx vim syntax highlighting (on Ubuntu/Debian)
View install_nginx_vim.sh
#!/bin/sh
mkdir -p ~/.vim/syntax/
cd ~/.vim/syntax/
wget http://www.vim.org/scripts/download_script.php?src_id=19394
mv download_script.php\?src_id\=19394 nginx.vim
cat > ~/.vim/filetype.vim <<EOF
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif
EOF