This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function up() | |
{ | |
$this->addColumn('post', 'alias', 'varchar(255) NOT NULL'); | |
Yii::app()->cache->flush(); | |
Yii::app()->db->schema->getTables(); | |
Yii::app()->db->schema->refresh(); | |
foreach (Post::model()->findAll() as $post) { | |
$post->save(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def a ["qwe", | |
"asd" | |
"zxc", | |
"rty"]) | |
(def b ["qwe" | |
"asd", | |
"zxc" | |
"rty"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program > file # write program stdout to file | |
program1 | program2 # send stdout of program1 to stdin of program2 | |
program < file # write file to program stdin | |
program1 && program2 # exec program2 only if program1 returns 0 | |
program1; program2 # exec program2 ever if program1 failed | |
cmd1; cmd2; cmd3 & - will only execute cmd3 in the background | |
cmd1 && cmd2 && cmd3 & - will execute the entire chain in the background IF there are no errors. | |
To cater for unconditional execution, using parenthesis solves this : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XTerm*Background: #3465A4 | |
XTerm*Foreground: #EEEEEC | |
XTerm*font: 7x13 | |
XTerm*faceName: Terminus:size=10:antialias=false | |
XTerm*saveLines: 16000 | |
XTerm*HiForeColor: #EEEEEC | |
XTerm*HiBackColor: #3465A4 | |
XTerm*geometry: +35+120 | |
!tango color scheme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xterm*faceName: Terminus:size=10:antialias=false | |
xterm*font: 7x13 | |
xterm*inputMethod:ibus | |
xterm*termName: xterm-256color | |
xterm*utf8: 1 | |
xterm*locale: true | |
xterm*utf8Title: true | |
xterm*renderFont: true | |
!tango color scheme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PLEASE READ THE MAN PAGE BEFORE EDITING THIS FILE! | |
# http://opensource.conformal.com/cgi-bin/man-cgi?spectrwm | |
# colors for focussed and unfocussed window borders | |
# NOTE: all colors in this file are in hex! see XQueryColor for examples | |
# color_focus = red | |
# color_unfocus = rgb:88/88/88 | |
# bar settings | |
bar_enabled = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to convert a CVImageBufferRef to an OpenGL texture | |
outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch | |
CVImageBufferRef imageBuffer = CVBufferRetain(mCurrentImageBuffer); | |
GLuint texture = CVOpenGLTextureGetName(imageBuffer); | |
id provider= [context outputImageProviderFromTextureWithPixelFormat:QCPlugInPixelFormatARGB8 | |
pixelsWide:CVPixelBufferGetWidth(imageBuffer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
push = (element) -> (stack) -> | |
newStack = [element].concat stack | |
{value: element, stack: newStack} | |
pop = (stack) -> | |
element = stack[0] | |
newStack = stack.slice 1 | |
{value: element, stack: newStack} | |
bind = (stackOperation, continuation) -> (stack) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" https://bitbucket.org/brankovukelic/pyproto """ | |
from copy import copy | |
__all__ = ['Object'] | |
class Object(object): | |
"""Base prototype for prototypal object model in Python | |
To create a new object, simply instantiate an Object instance:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float screenResolution() { | |
struct utsname systemInfo; | |
uname(&systemInfo); | |
char *name = systemInfo.machine; | |
float ppi; | |
if ((strstr(name, "iPod") != NULL) && (strstr(name, "iPod4") == NULL)) { | |
// older ipod touches | |
ppi = 163; | |
} else if ((strstr(name, "iPhone") != NULL) && (strstr(name, "iPhone3") == NULL)) { |
OlderNewer