Skip to content

Instantly share code, notes, and snippets.

View taras's full-sized avatar

Taras Mankovski taras

View GitHub Profile
@taras
taras / gist:181654
Created September 6, 2009 04:57 — forked from anonymous/gist:156623
Scrapy Production/Worker/Dev Setup Fabfile
"""
Git Repo:
branches
dev
worker
production
master
dev
<?php
class Route {
public $name;
public $uri_templates = array();
public $params = array();
public function __construct($name, $uri_templates) {
$this->name = $name;
var empty, get, set,
__hasProp = {}.hasOwnProperty;
get = Ember.get;
set = Ember.set;
empty = function(obj) {
var key;
for (key in obj) {
if (!__hasProp.call(obj, key)) continue;
# So, this is pretty horrible. If we just encode using btoa, any UTF-8 chars cause an error.
# If we use either of the workarounds on MDN[1], the £ sign is encoded wrong. I suspect
# Excel totally sucking at encodings is the reason why. So, the workaround is, to use
# the MDN workaround on chars with values > 255, and allow chars 0-255 to be encoded
# as is with btoa. Note that if you use either of the workarounds on MDN, chars
# 128-255 will be encoded as UTF-8, which includeds the £ sign. This will cause excel
# to choke on these chars. Excel will still choke on chars > 255, but at least the £
# sign works now...
# [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding
@taras
taras / 0_reuse_code.js
Created February 2, 2014 23:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@taras
taras / README.md
Last active October 13, 2015 21:08 — forked from Integralist/git apply gist diff.sh
Stash a `git diff` to gist to abort an upgrade but not loose your progress

Not every Ember upgrade goes as planned. Back out - to fight another day, by stashing your WIP to a Gist.

Installation

gem install gist

Login

gist --login

Send a diff to gist

git diff | gist -p -f wip-upgrade.diff # -> returns a url, save the url to later restore your diff

attributes relationships
parent
data
type id
parents
1
@taras
taras / application.controller.js
Last active December 23, 2015 03:51 — forked from ZackMattor/application.controller.js
finalizeQueryParamChange - With A solution
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['test'],
appName:'finalizeQueryParamChange bug example',
actions: {
set_param() {
this.set('test', 'foo');
}
@taras
taras / redirect-to-www.php
Last active July 13, 2016 19:07 — forked from mikeschinkel/redirect-to-www.php
MU-Plugin for WordPress to redirect from non-www to www domain
<?php
if ( ! preg_match( '#wp-json#', $_SERVER['REQUEST_URI'] ) && ! preg_match( '#wp-content#', $_SERVER['REQUEST_URI'] ) && ! preg_match( '#^www.#', $_SERVER['HTTP_HOST'] ) ) {
$https = 443 === $_SERVER['SERVER_PORT'] ? 's' : '';
header( "Location: http{$https}://www.{$_SERVER['HTTP_HOST']}", true, 301 );
die();
}
import Ember from 'ember';
export default Ember.Controller.extend({
myService: Ember.inject.service('my-service'),
appName: 'Ember Twiddle'
});