Skip to content

Instantly share code, notes, and snippets.

poor p2or

Block or report user

Report or block p2or

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View formatnumbers.py
#http://stackoverflow.com/questions/733454/best-way-to-format-integer-as-string-with-leading-zeros
def formatNumbers(number, length):
return '%0*d' % (length, number)
@p2or
p2or / functions.php
Created Jul 17, 2014
wordpress - add class to the_post_thumbnail
View functions.php
<?php the_post_thumbnail('post-thumbnail', array( 'class' => "grid_4 img-max attachment-post-thumbnail")); ?>
@p2or
p2or / colorTempToRGB.js
Created Dec 18, 2015 — forked from paulkaplan/colorTempToRGB.js
Color Temperature to RGB
View colorTempToRGB.js
// From http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
// Start with a temperature, in Kelvin, somewhere between 1000 and 40000. (Other values may work,
// but I can't make any promises about the quality of the algorithm's estimates above 40000 K.)
function colorTemperatureToRGB(kelvin){
var temp = kelvin / 100;
View blender-suppressOperatorOutput.py
# for http://blender.stackexchange.com/questions/56087/check-if-an-operation-can-be-applied-without-runtime-errors
import bpy
import io
from contextlib import redirect_stdout
if bpy.ops.mesh.fill_grid.poll():
print("correct context")
else:
@p2or
p2or / debug.css
Last active Jul 15, 2016
css-debug
View debug.css
* {
background: #000 !important;
color: #0f0 !important;
outline: solid #f00 1px !important;
}
View cpp2011.sublime-build
{
"cmd": ["g++", "-std=c++0x", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"cmd":["bash", "-c", "g++ -std=c++0x '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
@p2or
p2or / print_github_bitbucket.js
Created Jul 24, 2016 — forked from markov00/print_github_bitbucket.js
Github print styling bookmarlet
View print_github_bitbucket.js
javascript:void%20function(){(function(e,o,i,a,n,r,t,d){(!(n=e.jQuery)||i%3En.fn.jquery||a(n))%26%26(r=o.createElement(%22script%22),r.type=%22text/javascript%22,r.src=%22http://ajax.googleapis.com/ajax/libs/jquery/%22+i+%22/jquery.min.js%22,r.onload=r.onreadystatechange=function(){t||(d=this.readyState)%26%26%22loaded%22!=d%26%26%22complete%22!=d||(a((n=e.jQuery).noConflict(1),t=1),n(r).remove())},o.documentElement.childNodes[0].appendChild(r))})(window,document,%221.3.2%22,function(e,o){e(%22%23header,%20.header,.gh-header-actions,.repo-nav,.site-footer,%20.pagehead,%20.breadcrumb,%20.commit,%20.meta,%20%23footer,%20%23footer-push,%23wiki-rightbar%22).remove(),e(%22%23files,%20.file%22).css({background:%22none%22,border:%22none%22}),e(%22.aui-group,.aui-sidebar,.aui-header,%23wiki%20header,footer,.revision-date%22).css({display:%22none%22}),e(%22%23wiki%20.wiki-content%22).css({border:%22none%22,overflow:%22hidden%22}),e(%22.aui-page-panel%22).css({%22padding-left%22:0}),e(%22link%22).removeAttr(%22media%22
View typecheck.py
def typecheck(obj):
return hasattr(obj, '__iter__') and not isinstance(obj, str)
View ae-time-code-expression.js
h=0;m=00;s=0;f=0;
f+=timeToFrames();
s+=Math.floor(f*thisComp.frameDuration);
m+=Math.floor(s/60);
h+=Math.floor(m/60);
f=f%(1/thisComp.frameDuration);
s=s%60;
m=m%60;
if(f<10) {f="0"+f}
if(s<10) {s="0"+s}
View illustrator-rename-selection.js
function addLeadingZeros (n, length){
var str = (n > 0 ? n : -n) + "";
var zeros = "";
for (var i = length - str.length; i > 0; i--)
zeros += "0";
zeros += str;
return n >= 0 ? zeros : "-" + zeros;
}
You can’t perform that action at this time.