Skip to content

Instantly share code, notes, and snippets.

View kousherAlam's full-sized avatar
💭
I may be slow to respond..

Kousher alam kousherAlam

💭
I may be slow to respond..
View GitHub Profile
@kousherAlam
kousherAlam / jsCoreDomFunctions.js
Last active November 19, 2018 04:56
basic dom functionality implemented with prototype
document.addEventListener("DOMContentLoaded", function(){
// write your script here
var demo = _("demo");
demo.html("Hello").addClass("hi").attr('data-name','test')
.css('background-color-is-','black');
// demo.addClass("your anme");
// demo.fadeIn();
// demo.remove();
// demo.hide();
console.log(demo);
@kousherAlam
kousherAlam / browser-sync-config.js
Created March 4, 2018 17:00 — forked from christopher4lis/browser-sync-config.js
Webpack Dev Server + Browser Sync Config
new BrowserSyncPlugin({
host: 'localhost',
port: 3001,
proxy: 'http://localhost:8081/',
files: [{
match: [
'**/*.hbs'
],
fn: function(event, file) {
if (event === "change") {
@kousherAlam
kousherAlam / hot-reload-extracted-stylesheets
Created March 4, 2018 16:39 — forked from christopher4lis/hot-reload-extracted-stylesheets
This snippet allows webpack-dev-server to hot reload stylesheets extracted with the ExtractTextWebpackPlugin
if (module.hot) {
const hotEmitter = require("webpack/hot/emitter");
const DEAD_CSS_TIMEOUT = 2000;
hotEmitter.on("webpackHotUpdate", function(currentHash) {
document.querySelectorAll("link[href][rel=stylesheet]").forEach((link) => {
const nextStyleHref = link.href.replace(/(\?\d+)?$/, `?${Date.now()}`);
const newLink = link.cloneNode();
newLink.href = nextStyleHref;
@kousherAlam
kousherAlam / blog-loop.html
Created February 1, 2018 20:38 — forked from kylerush/blog-loop.html
An example of a blog post loop in Jekyll.
{% for post in site.posts %}
<article class="{% if forloop.first %}first{% elsif forloop.last %}last{% else %}middle{% endif %}">
<div class="article-head">
<h2 class="title"><a href="/{{ post.url }}/" class="js-pjax">{{ post.title }}</a></h2>
<p class="date">{{ post.date | date: "%b %d, %Y" }}</p>
</div><!--/.article-head-->
<div class="article-content">
{{ post.long_description }}
<a href="/{{ post.url }}/" class="full-post-link js-pjax">Read more</a>
</div><!--/.article-content-->
@kousherAlam
kousherAlam / Angular-vscode-exclude.json
Last active January 26, 2018 05:50
Exclude Angular's all unnecessary files and folder form vscode :)
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
// root level folder exclue
"node_modules": true,
".vscode": true,
@kousherAlam
kousherAlam / links
Last active September 29, 2017 11:33
@kousherAlam
kousherAlam / Emmet.sublime-settings
Last active September 14, 2017 11:56
Emmet Sublime Settings to easily done the work.
{
"disable_formatted_linebreak": true,
"snippets": {
"html": {
"abbreviations": {
"template": "!!!+html>(head>meta:utf+meta:compat+meta:vp+title${title}+link:css)+body>script:src",
"bs-nav": "nav#$.navbar.navbar-default>.container-fluid>(.navbar-header>a[href='#'].navbar-brand{BrandName})+ul.nav.navbar-nav>li*6>a[href='#']",
"bs-dropdown": ".dropdown>(button.btn.btn-primary.dropdown-toggle[type='button' data-toggle='dropdown']{Dropdown}>span.caret)+ul.dropdown-menu>li*4>a[href='#']{Menu Item}",
"bs-accordion": ".panel-group#accordion>(.panel.panel-default>(.panel-heading>.panel-title>a[data-toggle='collapse' data-parent='#accordion' href='#collapse$'])+#collapse$.panel-collapse.collapse>.panel-body>lorem10)*3",
var COMMENT_PSEUDO_COMMENT_OR_LT_BANG = new RegExp(
'<!--[\\s\\S]*?(?:-->)?'
+ '<!---+>?' // A comment with no body
+ '|<!(?![dD][oO][cC][tT][yY][pP][eE]|\\[CDATA\\[)[^>]*>?'
+ '|<[?][^>]*>?', // A pseudo-comment
'g');
function seoUrl($string) {
//first trim everyting... :)
$string = trim($string);
//Lower case everything
$string = strtolower($string);
//Make alphanumeric (removes all other characters)
$string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
//Clean up multiple dashes or whitespaces
$string = preg_replace("/[\s-]+/", " ", $string);
//Convert whitespaces and underscore to dash
define( 'SHORTINIT', true );
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$url = $_SERVER['REQUEST_URI'];
$my_url = explode('wp-content' , $url);
$path = $_SERVER['DOCUMENT_ROOT']."/".$my_url[0];