Skip to content

Instantly share code, notes, and snippets.

View mmdsharifi's full-sized avatar
🏠
Working from home

Mohammad Sharifi mmdsharifi

🏠
Working from home
View GitHub Profile
@Kavithvajen
Kavithvajen / deploy.sh
Created July 18, 2020 11:26
Z Shell (zsh) script to manage a Hugo site hosted on GitHub Pages. YouTube Link: https://youtu.be/5TrMF_aFa5E
#!/bin/zsh
vared -p "Enter commit message: " -c message
printf "\e[33m\nBuilding project...\e[39m\n"
hugo -d ../YOUR_GITHUB_USERNAME.github.io
printf "\\e[33m\nPushing to YOUR_GITHUB_USERNAME.github.io repository...\e[39m\n\n"
cd ../YOUR_GITHUB_USERNAME.github.io
git add .
@FoseFx
FoseFx / Testing an Akita-Angular Application with Cypress.md
Last active September 18, 2019 20:23
Testing an Akita-Angular Application with Cypress

Testing an Akita-Angular Application with Cypress

Cypress is one of the easiest ways to test your Angular application. But because it is not tied to any Angular API it is hard to look "under the hood" of your tested app. However directly manipulating the internal State of it can make testing even easier. This gist will show you a way to achieve this.

Unfortunately, we need to write a bit of overhead into our Application, this is marginal though.

Get State in Cypress

To write a binding for Cypress we need to create a function that needs to be called in the constructor of each of our Akita Queries. Make sure to pass the query itself to it using this. Cypress provides a global window.Cypress variable we can use todetermine whether we are in a Cypress testing environment.

cypressBinding.ts:

@JonCatmull
JonCatmull / file-size.pipe.ts
Last active April 14, 2024 14:27
Angular2 + TypeScript file size Pipe/Filter. Convert bytes into largest possible unit. e.g. 1024 => 1 KB
/**
* @license
* Copyright (c) 2019 Jonathan Catmull.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@lbrenman
lbrenman / ACS.js
Last active January 18, 2017 13:46
Appcelerator Titanium, Appcelerator mBaaS, Raspberry Pi - Full Stack JavaScript iOT Example to use mobile app to control RPi through mBaaS
var Cloud = require('ti.cloud');
exports.ACSLogin = function(u,p,o){
Ti.API.debug("ACS: ACSLogin()");
if(Titanium.Network.networkType == Titanium.Network.NETWORK_NONE){
alert("No Network. Please try again later.");
if (o.error) { o.error("ACSLogin(): No Network"); };
return;
}

Git Cheat Sheet

Commands

Getting Started

git init

or

@iHassan
iHassan / Galaxy Of Tutorial Torrents
Created February 11, 2015 01:20
Ultimate Galaxy Of Tutorial Torrents
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@torgeir
torgeir / gulpfile.js
Last active June 12, 2023 09:52 — forked from markgoodyear/01-gulpfile.js
Example gulpfile.js
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
@jareware
jareware / SCSS.md
Last active April 23, 2024 22:13
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@eAmin
eAmin / en2fa.js
Created January 19, 2011 12:33
English Digit to Persian
/*
* English digit to persian
* Copyright(C) 2009 by Amin Akbari [ http://eAmin.me/ ]
* Licensed under the MIT Style License [http://www.opensource.org/licenses/mit-license.php]
*
*/
String.prototype.toFaDigit = function() {
return this.replace(/\d+/g, function(digit) {
var ret = '';