Skip to content

Instantly share code, notes, and snippets.

View ierhyna's full-sized avatar

Irina Sokolovskaia ierhyna

View GitHub Profile
@alexkingorg
alexkingorg / sort-colors.php
Created March 22, 2012 13:44
Sort colors from dark to light
<?php
function cf_sort_hex_colors($colors) {
$map = array(
'0' => 0,
'1' => 1,
'2' => 2,
'3' => 3,
'4' => 4,
'5' => 5,
@jfensign
jfensign / index.js
Created April 9, 2012 00:24
NodeJS User Registration and Authentication
//index.js
var express = require('express'),
app = module.exports = express.createServer(),
mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/nodeAuth');
//configure app
app.configure(function() {
app.set('views', __dirname + '/views');
@thefuxia
thefuxia / plugin-class-demo.php
Last active April 11, 2024 13:50
Plugin Class Demo
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Plugin Class Demo
* Description: How I am using the base class in plugins.
* Plugin URI:
* Version: 2012.09.29
* Author: Fuxia Scholz
* License: GPL
* Text Domain: plugin_unique_name
* Domain Path: /languages
@norcross
norcross / wp-version-check.php
Created December 8, 2012 02:16
WP version check
// do a version check
$version = get_bloginfo('version');
if ($version < 3.5) {
//do whatever you were doing before
} else {
// do something new for the swanky 3.5 UI
}
@mwhite
mwhite / git-aliases.md
Last active June 18, 2024 05:31
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@frankyonnetti
frankyonnetti / GIT--master-merge.txt.md
Last active May 23, 2021 19:10
#GIT Replace master with current working branch
@twistedstream
twistedstream / reinstall-node-via-homebrew.md
Last active October 10, 2023 11:48
How to reinstall Node + NPM via NVM

Remove existing Node/NPM

If you installed Node directly using Homebrew, then uninstall it by running:

brew uninstall node

Now, clean up the rest:

@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@himynameisdave
himynameisdave / button-animated.less
Last active March 7, 2019 21:12
Animated CSS Gradient Complete
.button {
background-size: 100%;
background-image: linear-gradient(#fff, #ccc);
border-radius: 0.45rem;
border: 1px solid #ddd;
cursor: pointer;
color: #333;
display: inline-block;
font-size: 1.25rem;
font-weight: 300;
let animal = {
animalType: 'animal',
describe () {
return `An ${this.animalType}, with ${this.furColor} fur,
${this.legs} legs, and a ${this.tail} tail.`;
}
};
let mouse = Object.assign(Object.create(animal), {