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
var now = new Date(); | |
var h = now.getHours(); | |
h = h > 9 ? h : '0'+h; | |
var m = now.getMinutes(); | |
m = m > 9 ? m : '0'+m; | |
var s = now.getSeconds(); | |
s = s > 9 ? s : '0'+s; | |
var ms = now.getMilliseconds(); | |
n = '['+h+':'+m+':'+s+'.'+ms+'] '+n; | |
console.log(n,item); |
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
for i in $(ls | cut -f1 -d. | uniq); do convert -resize 24 $i.png $i-24.png; done |
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
# after upgrading wheezy or after dist-upgrade wheezy to jessie | |
# I was getting this error almost on every program like sublime text, gimp and many more | |
# ../../../../src/cairo-scaled-font.c:459: _cairo_scaled_glyph_page_destroy: Assertion `!scaled_font->cache_frozen' failed. | |
# here's what fixed it for me: | |
sudo dpkg-reconfigure fontconfig-config | |
# selecting "Native" -> "Automatic" -> "No" | |
# by that point everything was working good, but just to make sure run: | |
sudo dpkg-reconfigure fontconfig |
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
#!/bin/bash | |
# sometimes, when checking a pull request, I wanted to commit my own changes into the forked repo | |
# and return it to the developer for more work. I wanted to do that without cloning his repo. | |
# So what I'm doing is first, setup a remote: | |
git remote add [upstream_name] https://[myusername]@github.com/[remoteuser]/[repo].git | |
# you can see it now under | |
git remote -v | |
# then sync branches | |
git fetch [upstream_name] | |
# then I checkout to a new branch (if I didn't do it earlier) |
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
# connect your camera with USB cable, for 6D model you have to disable the WiFi first. | |
# then see if camera is connected by using: | |
gphoto2 --auto-detect | |
# if you see something like: | |
# | |
# user@x250:~$ gphoto2 --auto-detect | |
# Model Port | |
# ---------------------------------------------------------- | |
# Canon EOS 6D usb:001,006 | |
# |
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
if (typeof jQuery != 'undefined') { | |
console.log(jQuery.fn.jquery); | |
} else { | |
var jq = document.createElement('script'); jq.type = 'text/javascript'; | |
jq.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js'; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
var j = jQuery.noConflict(true); | |
} |
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
$query = db_select('taxonomy_term_data', 't'); | |
$query->fields('t',array('tid')); | |
$query->condition('name',''); | |
$tids = $query->execute()->fetchCol(); | |
db_delete('taxonomy_term_data') | |
->condition('tid', $tids,'IN') | |
->execute(); |
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
$(document).click(function(e){ | |
var clickElement = e.target; // get the dom element clicked. | |
var elementClassName = e.target.className; // get the classname of the element clicked | |
console.log(e); | |
}); |
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
<?php | |
// Table header | |
$header = array( | |
'fruit' => t('Fruit'), | |
'a' => t('Vitamin A'), | |
'b1' => t('Vitamin B1'), | |
'b2' => t('Vitamin B2'), | |
); | |
// Table rows |
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
<?php | |
// Create a node object, and add node properties. | |
$newNode = new stdClass(); | |
$newNode->type = 'node_example'; | |
$newNode->uid = 0; | |
$newNode->created = strtotime("now"); | |
$newNode->changed = strtotime("now"); | |
$newNode->status = 1; | |
$newNode->comment = 0; | |
$newNode->promote = 0; |
NewerOlder