Skip to content

Instantly share code, notes, and snippets.

View dimayakovlev's full-sized avatar

Dmitry Yakovlev dimayakovlev

View GitHub Profile
@nathansmith
nathansmith / module_pattern_init.js
Created January 11, 2010 17:08
Init + Module Pattern JS
// JS Module Pattern:
// http://j.mp/module-pattern
// Redefine: $, window, document, undefined.
var APP = (function($, window, document, undefined) {
// Automatically calls all functions in APP.init
$(document).ready(function() {
APP.go();
});
@anwarishak
anwarishak / model.php
Created April 30, 2012 14:33
Abstract "model" class in a custom PHP MVC framework - also forms the basis of the framework's ORM
<?php
/**
* Abstract class that serves as the Model in the MVC framework.
*
* A Model is a representation of the information in the application. A Model's
* data is saved in the database and the class is used to handle all the
* business logics. This class handles the standard create, read, update
* and delete operations. It must be extended to create the concrete
* implementation of a Model, and handle any other business logics specific to
@thomd
thomd / semantic-layout.html
Last active November 11, 2024 20:30
Standard HTML5 Semantic Layout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Title</title>
<link href="stylesheets/main.css" rel="stylesheet" />
</head>
<body>
<header>
<hgroup>
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@davidsneal
davidsneal / html-share-buttons.html
Last active December 12, 2023 13:18
HTML Share Buttons
<!-- I got these buttons from simplesharebuttons.com -->
<div id="share-buttons">
<!-- Buffer -->
<a href="https://bufferapp.com/add?url=https://simplesharebuttons.com&amp;text=Simple Share Buttons" target="_blank">
<img src="https://simplesharebuttons.com/images/somacro/buffer.png" alt="Buffer" />
</a>
<!-- Digg -->
<a href="http://www.digg.com/submit?url=https://simplesharebuttons.com" target="_blank">
@stefanbc
stefanbc / perms.md
Last active April 22, 2025 16:48
Set proper permissions on /var/www/

HOWTO

To set up permissions on /var/www where your files are served from by default:

sudo addgroup webmasters
sudo adduser $USER webmasters
sudo chown -R root:webmasters /var/www
sudo find /var/www -type f -exec chmod 664 {} \;
sudo find /var/www -type d -exec chmod 775 {} \;
/**
* Load more content over ajax in a nice manner
*
* This script utilizes Font Awesome to give proper visual feedback
* while the new content is being fetched and loaded
*
* Usage:
* - Attach the class 'load-more-content' to any a tag in the DOM
* - Give this object a data attribute of data-content-area which indicates
* what part of the site is to be loaded in
@lokothodida
lokothodida / getsimple-tutorial-shortcodes.md
Last active December 18, 2017 04:56
GetSimple tutorial for adding shortcode-like to the admin panel.

GetSimple Tutorial: Shortcodes

Sometimes you have content that you want to place onto a page that requires a bit of messy HTML, CSS and PHP coding. This can be very frustrating when there are multiple occurrences of said piece of content within your page, and when each occurrence requires something different about it. What is even worse is when the person who needs to manipulate this content isn't very confident with the above markup (HTML, CSS) and code (PHP) languages, yet they need to be able to edit the necessary pieces without breaking a crucial piece of the markup. Wouldn't it be great if GetSimple had such a function?

Other content management systems such as forums and Wordpress do have such functions, called BBCode and Shortcodes respectively, which allow for dynamic content to be output on pages without knowledge of the messy code that goes in beforehand. For example, on forums you can often place a link on the page by simply using [url][/url] tags instead of knowing how to use HTML anchors and p

@jdhitsolutions
jdhitsolutions / ChristmasWishes.ps1
Created December 24, 2015 15:49
Display a colorful and randomly selected Christmas message.
<#
Display a randomly selected holiday quote in a festive color scheme
you can find more Christmas quotes at
http://www.brainyquote.com/quotes/topics/topic_christmas.html
Learn more about PowerShell:
http://jdhitsolutions.com/blog/essential-powershell-resources/
#>
@lokothodida
lokothodida / README.md
Last active March 25, 2016 19:46
GetSimple Theme Developer Language Helper Functions

GetSimple Theme Developer Language Helper Functions

Allows GetSimple theme designers to have theme-dependent language strings in a lang folder of their theme.

Usage

  1. Add language_functions.php (from this gist) to your current theme's folder.
  2. Create a lang folder in your current theme
  3. Create language files for your theme with file names corresponding to language codes: