Skip to content

Instantly share code, notes, and snippets.

💭
Searching....

Zafar Ansari ansarizafar

💭
Searching....
Block or report user

Report or block ansarizafar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View App.dart
Future main() async {
final Iterable<Locale> supportedLocales = [Locale('en'), Locale('ar')];
await Langs.init(supportedLocales: supportedLocales, loadDeviceLanguage: true);
runApp(MyApp(supportedLocales: supportedLocales));
print(Langs.string('sample.item.name'));
print(Langs.string('name'));
}
@ansarizafar
ansarizafar / HighlightedLink.svelte
Created Sep 16, 2019 — forked from jcollum/HighlightedLink.svelte
Svelte + Sapper highlighted link (component that is aware of current url)
View HighlightedLink.svelte
@ansarizafar
ansarizafar / example.js
Created Apr 24, 2019 — forked from johanalkstal/example.js
Basic Svelte Store Routing
View example.js
/**
* Basic example of routerless store based routing.
* To understand what is going on check out
* https://svelte.dev/tutorial/writable-stores
* https://www.npmjs.com/package/feather-route-matcher
*/
// stores.js
View minimal-analytics-snippet.js
(function (history, trackingId, options) {
const generateId = () => {
return '_' + Math.random().toString(36).substr(2, 9);
};
const getId = () => {
if (!localStorage.cid) {
localStorage.cid = generateId()
}
return localStorage.cid;
};
@ansarizafar
ansarizafar / main.css
Created Dec 11, 2018 — forked from abhishekjakhar/main.css
HTML Tables CSS File
View main.css
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: 'Lato', sans-serif;
color: #333;
font-weight: 400;
@ansarizafar
ansarizafar / gradients.js
Created Oct 5, 2018 — forked from cossssmin/gradients.js
Tailwind CSS background-image gradients plugin
View gradients.js
const _ = require('lodash');
module.exports = ({e, addUtilities, config}) => {
const gradients = config('gradients', [])
const variants = config('modules.gradients')
const gradientUtilities = _.map(gradients, (colors, name) => {
if (!_.isArray(colors)) {
colors = ['transparent', colors];
}
View unregisterServiceWorkers.js
navigator.serviceWorker.getRegistrations().then(function (registrations) {
if (!registrations.length) {
console.log('No serviceWorker registrations found.')
return
}
for(let registration of registrations) {
registration.unregister().then(function (boolean) {
console.log(
(boolean ? 'Successfully unregistered' : 'Failed to unregister'), 'ServiceWorkerRegistration\n' +
(registration.installing ? ' .installing.scriptURL = ' + registration.installing.scriptURL + '\n' : '') +
@ansarizafar
ansarizafar / requestIdleCallback.js
Created Sep 21, 2018 — forked from paullewis/requestIdleCallback.js
Shims rIC in case a browser doesn't support it.
View requestIdleCallback.js
/*!
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ansarizafar
ansarizafar / svelte-observe.js
Created Sep 14, 2018 — forked from jacwright/svelte-observe.js
One `observe` for all svelte needs.
View svelte-observe.js
export function observe(key, callback, opts) {
const single = !Array.isArray(key);
const keypaths = single ? [ key ] : key;
const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.'));
const keys = parts.map(parts => parts[0]);
const fn = callback.bind(this);
let last = parts.map(parts => getNestedValue(this.get(), parts));
if (!opts || opts.init !== false) {
@ansarizafar
ansarizafar / svelte-observe.js
Created Sep 14, 2018 — forked from jacwright/svelte-observe.js
One `observe` for all svelte needs.
View svelte-observe.js
export function observe(key, callback, opts) {
const single = !Array.isArray(key);
const keypaths = single ? [ key ] : key;
const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.'));
const keys = parts.map(parts => parts[0]);
const fn = callback.bind(this);
let last = parts.map(parts => getNestedValue(this.get(), parts));
if (!opts || opts.init !== false) {
You can’t perform that action at this time.