Skip to content

Instantly share code, notes, and snippets.

View sapegin's full-sized avatar
🌄
Disconnected

Artem Sapegin sapegin

🌄
Disconnected
View GitHub Profile
module.exports = function(grunt) {
'use strict';
require('matchdep')
.filterDev('grunt-*')
.forEach(grunt.loadNpmTasks);
grunt.initConfig({
// ...
@sunify
sunify / gulpfile.js
Last active August 29, 2015 14:17
My webpack+gulp config
var notifier = require('node-notifier');
var gulp = require('gulp');
var g = require('gulp-load-plugins')();
var lr = require('tiny-lr');
var server = lr();
var minimist = require('minimist');
var env = minimist(process.argv.slice(2));
var debug = !!env.debug || !!env.d;
import React, { Component, PropTypes } from 'react';
export default class CreditCardField extends Component {
static propTypes = {
value: PropTypes.string,
onChange: PropTypes.func,
}
static defaultProps = {
value: ''
}

See .

@mrcgrtz
mrcgrtz / favicon.html
Created May 6, 2010 08:13
Get a favicon as PNG image via Google.
<img src="http://www.google.com/s2/favicons?domain=yourdomain.tld" width="16" height="16" alt="Favicon">
@pagles
pagles / gist:1005962
Created June 3, 2011 06:34
Using django taggit with custom tags
class MyTag(TagBase):
def slugify(self, tag, i=None):
slug = slughifi(tag)
if i is not None:
slug += "_%d" % i
return slug
class Meta:
verbose_name = _("Tag")
@joemccann
joemccann / exbp.sh
Created June 6, 2011 15:07
Another express boilerplate with normalize.css and jQuery
# /bin/bash
# run from Express project root directory
# Dependencies: wget, node.js, npm, express
# change these to the versions you want
JQ="1.6.1"
echo '\nGenerating Express app.\n'
express -t ejs -c stylus
@sapegin
sapegin / formatnumber.js
Created June 7, 2011 13:27
JavaScript Cookbook
function formatNumber(value) {
value = value.toString()
.replace(".", ",")
.replace(" ", "")
.replace("-", "&minus;");
var re = /(\d+)(\d{3})/;
while (re.test(value)) {
value = value.replace(re, "<i>$1</i>$2");
}
jQuery.fn.renew = function() {
return $(this.selector);
};
$('div').renew();
@FGRibreau
FGRibreau / grunt_growl.js
Created June 6, 2012 09:10
How to get Growl notifications from Grunt.js
/* Inside grunt.js file (don't forget to add "growl" as a project dependency) */
grunt.utils.hooker.hook(grunt.fail, "warn", function(opt) {
require('growl')(opt.name, {
title: opt.message,
image: 'Console'
});
});