Skip to content

Instantly share code, notes, and snippets.

@theshem
theshem / posts.js
Created December 4, 2018 10:48 — forked from masious/posts.js
export const posts = [
{
"id": 1,
"title": "نهمین جشنواره رسانه‌های دیجیتال",
"author": "ساسان",
"date": "۲۸ دی ۹۵",
"visits": 253,
"body": "نهمین جشنواره رسانه‌های دیجیتال در پنج بخش اصلی برگزار می‌شود. شما توسعه‌دهندگان گرامی می‌توانید تا پایان دی‌ماه برنامه‌های خود را در بخش «نرم افزارهای تلفن همراه و رسانه های هوشمند» این جشنواره ثبت کنید. برای کسب اطلاعات بیشتر می‌توانید به این <a href='http://fair.saramad.ir/fa/home' target='_blank'>لینک </a> مراجعه کنید."
},
{
@theshem
theshem / example.js
Created October 29, 2016 16:25
AnimationEnd and TransitionEnd Cross Browser
import { getAnimatableEndEvent } from './getAnimatableEndEvent';
// get the transitionend event name for cross browser compatibility
const transitionEndEvent = getAnimatableEndEvent('transition');
// later in code:
// element.addEventListener(transitionEndEvent, () => {}, false);
// get the animationend event name for cross browser compatibility
const animationEndEvent = getAnimatableEndEvent('animation');
// later in code:
@theshem
theshem / SassMeister-input.scss
Created March 12, 2014 10:54
Generated by SassMeister.com.
// ----
// Sass (v3.3.1)
// Compass (v1.0.0.alpha.18)
// ----
$mq_phone: "screen and (max-width: 500px)";
@media #{$mq_phone} {
.no-phone {
display: none;
@theshem
theshem / SassMeister-input.scss
Created February 15, 2014 20:02
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.4)
// Compass (v1.0.0.alpha.18)
// ----
@function set-color($color) {
@if (lightness($color) > 40) {
@return #000;
}
@else {
sudo apt-get --force-yes install build-essential openssl libreadline6 libreadline6-dev curl git-core \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
&&
\curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
&&
@theshem
theshem / assets.php
Last active December 20, 2015 17:29
An approach to use all CodeIgniter functions inside external JavaScript and CSS files. This is not the WAY I suggest, nor I do myself; but, It can be inspiring.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter Assets controller
*
* @author Hashem Qolami <[email protected]>
* @copyright 2013 Hashem Qolami
* @license http://opensource.org/licenses/MIT (MIT license)
*/
class Assets extends CI_Controller
@theshem
theshem / sample_controller.php
Last active December 19, 2015 17:49
CodeIgniter Snippet: How to load JavaScript files and/or code on a specific view
<?php
class Sample_controller extends CI_Controller {
/**
* Foo()
* @return void
*/
public function foo()
{
// External JavaScript files
$data['js'] = array(
@theshem
theshem / calcStr.beta.php
Last active December 15, 2015 12:39
How to Calculate arithmetic operators in strings via PHP
<?php
function calc($str)
{
$compute = create_function('', 'return (' . trim($str) . ');' );
return $compute();
}
# Demonstration
$string = " (5 - 1) * (6 / 2 + 1) ";
@theshem
theshem / gist:3833143
Created October 4, 2012 11:52
HTML: XHTML5 Starting Template
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<meta name="description" content="description here..." />
<meta name="keywords" content="keywords,here,..." />
<meta name="robots" content="index, follow" />
<link rel="stylesheet" type="text/css" href="style.css" />