Skip to content

Instantly share code, notes, and snippets.

View andreisebastianc's full-sized avatar

Andrei Sebastian Cîmpean andreisebastianc

View GitHub Profile
@andreisebastianc
andreisebastianc / gist:9109104
Created February 20, 2014 08:24
notes for modals
AbstractModalDialog += {
initialize: function () {
this.resolution: new Deferred();
}
accept: function () {
throw new Error('implement me');
},
reject: function () {
throw new Error('implement me');
}
@andreisebastianc
andreisebastianc / gist:9319255
Created March 3, 2014 06:01
Hackish approach for rendering images on WP mobile themes
function get_post_thumbnail($name){
if (!estimate_its_tablet()) {
the_post_thumbnail('mobile-'.$name);
return ;
} else {
the_post_thumbnail('tablet-'.$name);
return ;
}
the_post_thumbnail($name);
}
@andreisebastianc
andreisebastianc / work tmux workspace
Last active August 29, 2015 13:57
the script I use to initialize my work workspace
#!/bin/bash
SESSION_NAME="JS"
cd ~/Documents/work/project/app
tmux has-session -t ${SESSION_NAME}
if [ $? != 0 ]
then
tmux -2 new-session -d -s ${SESSION_NAME} -n 'CODE'
@andreisebastianc
andreisebastianc / gist:10342955
Created April 10, 2014 04:38
Wordpress helper class for paged querying
<?php
/**
*
*/
class PagedResourceQuery
{
public static $cachedQueries = array();
define([], function () {
return {
bindTo: function(model, key){
return {
value: model.get(key),
requestChange: function(value){
model.set(key, value);
}.bind(this)
}
}
@andreisebastianc
andreisebastianc / gist:53f7a62a7bc9b6c46ea3
Created July 6, 2014 19:57
Poor man backbone layout manager
_.extend(Backbone.View.prototype, {
serialize: function () {},
beforeRender: function () {},
afterRender: function () {},
render: function (where) {
var tmp, that;
this.beforeRender();
// @note assume template always set with tpl property
@andreisebastianc
andreisebastianc / dropdown-menu.jsx
Last active August 29, 2015 14:04
Dropdown menu approach for reatcjs
/** @jsx React.DOM */
define([
'react',
], function(React) {
"use strict";
var Dropdown = React.createClass({
getInitialState: function () {
return {
@andreisebastianc
andreisebastianc / gist:d89a0c3a2f7f77a53f37
Created October 22, 2014 12:10
nginx.conf sample for easy dev
location / {
proxy_pass http://127.0.0.1:9000;
}
location /api {
proxy_pass_header Set-Cookie;
proxy_pass https://XXXXXXX/api;
}
location /realtime {
@andreisebastianc
andreisebastianc / gist:2842729e70b874a7f225
Created April 29, 2015 04:31
Script to show who did what from a date period with GIT
rm ~/changelog.txt && git shortlog --no-merges --author="Cimpean" --reverse --after="2015-1-1" >> ~/changelog.txt && git log --author="Cimpean" --after="2015-1-1" --no-merges --pretty=format:'%cn%n %B %n' >> ~/changelog.txt
@andreisebastianc
andreisebastianc / ItemsList.jsx
Created September 11, 2015 16:00
POC for very basic injection of custom button at the end of a list
return {
renderEndOfListCustomButtonIfSet: function() {
// for more complex props.children verification we can use https://facebook.github.io/react/docs/top-level-api.html#react.children
if (this.props.children) {
return this.props.children;
}
return null;
}
render: function() {
<div>