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
# http://stackoverflow.com/a/8936202 | |
# | |
# ActiveAdmin already includes the necessary jquery in active_admin/base, | |
# so just add this to javascripts/active_admin.js after //= require active_admin/base | |
# | |
# | |
# Serialize and Sort | |
# | |
# model_name - you guessed it, the name of the model we are calling sort on. | |
# This is the actual variable name, no need to change it. |
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
inigo:tmp> script | |
Script started, file is typescript | |
inigo:tmp> git --no-pager log --pretty=format:"" --graph | |
# | |
# lots of colour output | |
# | |
inigo:tmp> exit | |
exit | |
Script done, file is typescript | |
# http://www.pixelbeat.org/scripts/ansi2html.sh |
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
[{exp:channel:categories channel="sections" style="linear"} | |
{"name":"{category_name}", | |
"thumb":"{category_image}", | |
"id":"{category_id}", | |
"image":"{image}", | |
"description":"{category_description}", | |
"pages":{exp:json:entries channel="sections" orderby="display_order" sort="asc" category="{category_id}"}}, | |
{/exp:channel:categories} | |
{"id":"-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
## SAMPLE data 3603.7517 N 11212.6268 W | |
lat_sign = LAT_FROM_DATA > 0 ? 1:-1 | |
lat = LAT_FROM_DATA | |
lat = lat[0,lat.length-1] #strip N | |
arr = lat.split('.') | |
if arr[0].length == 4 | |
deg= arr[0][0,2].to_f | |
min = arr[0][2,4].to_f | |
seconds = arr[1].to_f | |
lat = (deg + min/60 + seconds/600000).to_f |
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
ffmpeg -i input.avi -y -an -sameq -f image2 out/still-%03d.jpg |
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
find . -iname "*.jpg" | perl -e 'for(<>) { chomp $_;@a=split(/\//,$_);$str = "convert -resize 15% -quality 60 $_ _".$a[-1];print $str."\n";`$str`}' |
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
index do | |
column :image, :sortable => :image do |model| | |
if model.image.to_s.nil? | |
raw('—') | |
else | |
raw('✓') | |
end | |
end | |
end |
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
SELECT CONCAT('http://naturevalleytrailview.com/',parks.slug,'/',trails.slug,'#panorama-',interest_points.slug) | |
FROM `interest_points` | |
LEFT JOIN trails ON trails.id = interest_points.trail_id | |
LEFT JOIN parks ON parks.id = trails.park_id | |
WHERE `poi_type_id` = 1 ORDER BY parks.id |
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
function wpmu_latest_post_links($blog_path, $how_many = 10, $how_long_days = 30, $how_many_words = 50, $more_text = "[...]", $remove_html = true, $sort_by = 'post_date') { | |
global $wpdb; | |
//first, gat all blog id | |
$query = "SELECT blog_id FROM $wpdb->blogs WHERE blog_id !='1' AND path='" . $blog_path . "'"; | |
$blogs = $wpdb->get_col($query); | |
if ($blogs) { | |
//we use blog id to loop post query | |
foreach ($blogs as $blog) { |
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
server { | |
listen 80; | |
server_name raedatoui.com www.raedatoui.com; | |
access_log /srv/www/raedatoui.com/logs/access.log; | |
error_log /srv/www/raedatoui.com/logs/error.log; | |
root /srv/www/raedatoui.com/public; | |
location / { | |
#index index.html index.htm index.php; |
OlderNewer