Skip to content

Instantly share code, notes, and snippets.

View adyz's full-sized avatar
🔥
On fire

Adrian Florescu adyz

🔥
On fire
View GitHub Profile
@bcherny
bcherny / react-rollup-typescript.md
Last active January 30, 2024 12:13
react + rollup + typescript boilerplate

terminal:

npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx
@ksrb
ksrb / index.ejs
Last active March 10, 2021 05:58
jquery.inputmask webpack configuration and package.json
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<input id="float"/>
</body>
</html>
@leonderijke
leonderijke / svgfixer.js
Last active May 26, 2023 11:22
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html
@jintoppy
jintoppy / GlobalAjaxInterceptor
Last active September 13, 2016 12:40
A global ajax interceptor for Angular application, where it cancels all the previous state's ajax + http requests on state change. I am cancelling ajax requests also because some applications might still have some jquery utilities which does ajax requests.
angular.module('globalmodule')
.config(['$provide', '$httpProvider', function($provide, $httpProvider){
$provide.factory('GlobalAjaxInterceptor', ['$q', '$rootScope', function($q, $rootScope){
var currentRequests={http: {}, ajax: {}};
function addHttpRequest(conf){
currentRequests.http[conf.url] = conf.promiseObj;
}
@adyz
adyz / retina-simple-sprite-compass
Last active September 12, 2018 08:02
Retina Sprite CSS with Compass
// 1: To export the PNGs in different sizes I used Slicy - http://macrabbit.com/slicy/ - a mac app that looks into your PSD and if it finds any layer with .png extention will export that layer to PNG. You can also add a tag to the main group layer to export retina version too. A bit pricy, but it's fine if you value your time.
// 2: I added the icons in two folders (retina and normal) You just have to make sure that both folders contain the same number of files and they both have the same file name inside.
// 3: I added this code after long time of searchin, testing, and mashing my head into the wall.
$naviconsNormal: sprite-map("navicons/normal/*.png", $spacing: 10px);
@JohnAlbin
JohnAlbin / _init.scss
Last active December 26, 2015 18:09
Handing IE8 and lower with Breakpoint + compass/support
// Initialize the Sass variables and partials used in this project.
// Set the legacy IE support variables. We override the default values set by
// the compass/support partial, but let styles-ie8.scss override these values.
$legacy-support-for-ie6 : false !default;
$legacy-support-for-ie7 : false !default; // Note the use of !default.
$legacy-support-for-ie8 : false !default;
// Partials to be shared with all .scss files.
@thulstrup
thulstrup / compass-retina-sprites.scss
Created March 20, 2012 19:18
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));