Skip to content

Instantly share code, notes, and snippets.

View fmal's full-sized avatar
:octocat:
:octocat:‎ ‎‎‎ ‎ ‎:octocat:

Filip Malinowski fmal

:octocat:
:octocat:‎ ‎‎‎ ‎ ‎:octocat:
View GitHub Profile
@shankarcabus
shankarcabus / jquery.autoresize.js
Created November 5, 2013 17:21
Textarea autoresize
/*
* jQuery autoresize 0.1
* http://jusbrasil.com
* Copyright 2013
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* @author: webteam@jusbrasil.com.br
*/
@TexRx
TexRx / nice-box-shadow.css
Created November 13, 2013 06:22
Really nice subtle box-shadow settings
box-shadow: 0px 5px 7px -2px rgba(0, 0, 0, 0.4);
@berzniz
berzniz / jshipster_and_and.js
Last active May 22, 2022 23:15
Some small javascript hacks for hipsters
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;
@conradz
conradz / gist:7686821
Created November 28, 2013 03:21
rework-npm

rework-npm

I recently published rework-npm that allows you to import CSS files using the same rules that the Node.js uses for modules. This lets you install and manage CSS packages using npm the same way you manage JS modules.

Why npm?

First of all, why use npm? Why does it make sense to use npm for CSS? Npm is good for a number of reasons.

First, it is simple to use. Want to publish a module? Just use npm publish. Want to install a new package and save it to the dependencies? Just use npm install --save mymodule. This makes it super easy to create and maintain small modules, instead of putting everything into one large module.

@hemanth
hemanth / Gruntfile.js
Created December 31, 2013 14:13
grunt vs gulp
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: ['src/**/*.js'],
dest: 'dist/<%= pkg.name %>.js'
@floatdrop
floatdrop / gulpfile.js
Last active January 6, 2021 23:22
gulp.src - working with multiple source in one task
// npm i gulp event-stream
var gulp = require('gulp');
var es = require('event-stream');
gulp.task('test', function(cb) {
return es.concat(
gulp.src('bootstrap/js/*.js')
.pipe(gulp.dest('public/bootstrap')),
gulp.src('jquery.cookie/jquery.cookie.js')
@pedro-vasconcelos
pedro-vasconcelos / gist:280a12a9cc7b11b0dac3
Created May 9, 2014 11:13
Code to send e-mail with Swiftmailer and Amazon SES
require "swift-mailer-510/lib/swift_required.php";
$message = Swift_Message::newInstance()
->setCharset('utf-8')
->setSubject('Your subject')
->setFrom(array('from@example.com' => 'From Name'))
->setTo(array('to@example.com' => 'To Name'))
->setBody('Here is the message itself')
->addPart('<q>Here is the message itself</q>', 'text/html')
;
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@hdragomir
hdragomir / sm-annotated.html
Last active February 2, 2025 02:22
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active January 29, 2026 10:49
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository