Skip to content

Instantly share code, notes, and snippets.

View giiska's full-sized avatar
🌴
On vacation

Null giiska

🌴
On vacation
  • Godada
View GitHub Profile
@kjantzer
kjantzer / backbone.collection.saveToCSV.js
Last active May 14, 2017 10:21
Backbone.Collection.saveToCSV() — adds ability to save all of the collections models as a CSV file. NOTE: only tested on Chrome; may not work on all browsers, but would work well for packaged Chrome apps.
/*
Save To CSV 0.0.2
@author Kevin Jantzer, Blackstone Audio
@since 2015-01-16
intial code from http://stackoverflow.com/a/14966131/484780
TODO
- needs improved (objects as values)
// getCookie(), setCookie(), deleteCookie()
// возвращает cookie если есть или undefined
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
))
return matches ? decodeURIComponent(matches[1]) : undefined
@gregrickaby
gregrickaby / grd_functions.php
Last active April 10, 2018 02:38
A "must use" plugin to help save theme-agnostic functions
<?php
/**
* Must-Use Functions
*
* A class filled with functions that will never go away upon theme deactivation.
*
* @package WordPress
* @subpackage GRD
*/
class GRD_Functions {
@clayb
clayb / 4spaces_to_2spaces.sublime-macro
Last active December 21, 2015 11:28
Convert 4 spaces to 2 spaces in Sublime Text
[
{
"args": null,
"command": "select_all"
},
{
"args":
{
"set_translate_tabs": true
},
@johnregan3
johnregan3 / mysql2date-unit-test.php
Created August 9, 2013 15:33
WordPress Unit Test for get_post_time(), get_post_modified_time() and mysql2date()
<?php
/**
* Tests if get_post_time() and get_post_modified_time() return GMT(UTC) times correctly.
*
* get_post_time() and get_post_modified_time() have a parameter for GMT(UTC) time.
* However, they use mysqldate(), which does not take such a parameter.
* mysql2date() expects the default timezone to be set to GMT(UTC), but when it is not,
* get_post_time() and get_post_modified_time() do not correctly return GMT(UTC) time.
* To prove this, test_get_post_time() and test_get_post_modified_time() should return two
@mashpie
mashpie / i18n-express-hbs-app.js
Last active May 1, 2024 19:55
express + i18n-node + handlebars and avoid concurrency issues
// require modules
var express = require('express'),
i18n = require('i18n'),
hbs = require('hbs'),
app = module.exports = express();
i18n.configure({
locales: ['en', 'fr'],
cookie: 'locale',
directory: "" + __dirname + "/locales"
@tmiller
tmiller / merge
Last active November 14, 2021 11:16
Bash script to merge master into all branches
#!/bin/bash
# Merges the master branch into all other branches
#
# Process:
#
# - Save the name of the current branch
# - If the current branch is not master then checkout master.
# - Pull the latest changes for master from its upstream branch.
# - Loop over each local branch.
@kjantzer
kjantzer / Swipe Controls with Backbone.js and Hammer.md
Created December 13, 2012 19:26
Backbone.js: Swipe Controls

Swipe Controls with Backbone.js

Requires

Hammer.js

@Integralist
Integralist / 1. Example.scss
Created October 22, 2012 14:10
Sass Mixin for CSS3 Animations
@include keyframe(fadeout) {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@twalling
twalling / jquery.touch.js
Created October 19, 2012 19:11
Zepto touch for jQuery
;(function($){
var touch = {},
touchTimeout, tapTimeout, swipeTimeout,
longTapDelay = 750, longTapTimeout
function parentIfText(node) {
return 'tagName' in node ? node : node.parentNode
}
function swipeDirection(x1, x2, y1, y2) {