Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
@forsvunnet
forsvunnet / equalise-usage.js
Last active August 29, 2015 14:05
Equalise usage
// jQuery Closure mode
(function($){
// Resizing the propper way
var resize = function() {
$('element').equalise();
};
$(window)
.ready( resize )
.load( resize )
<?php /* This changes the CSV into another CSV. But merges duplicated fields. */
$fh = fopen("clubexp.csv", "r");
$row = 0;
$clubs = array();
while (($data = fgetcsv($fh, 1000, ",")) !== FALSE) {
// ID
$club_id = $data[0];
// Day
@halfempty
halfempty / functions.php
Created June 18, 2013 19:10
Show and save data to WordPress user profiles
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
<h3>Extra profile information</h3>
<table class="form-table">
#Make a new branch:
gco -b new_branch
#do bunch of changes
ga -A
gc -m "Made a bunch of changes"
#checkout master
gco master
#get the latest updates to master
gl
#Go back to new_branch or whatever you called it
@forsvunnet
forsvunnet / SH: wordpress_download.sh
Created September 24, 2013 15:59
A script to download and install wordpress in the provided folder. Will exit if the folder exists. Copy paste to aliases dot-file
function wpdl(){
if [[ -d ./${1} ]]; then
echo "Project directory exists, exiting..."
elif [[ $# = 1 ]]; then
mkdir $1
cd $1
curl -O http://wordpress.org/latest.zip
unzip latest.zip
rm latest.zip
mv wordpress/* ./
@tjhole
tjhole / ACF: Location > Static Google Map
Created December 12, 2013 18:48
ACF: Location > Static Google Map
<?php
$location = get_sub_field('location');
if( !empty($location) ):
?>
<img src="http://maps.googleapis.com/maps/api/staticmap?center=<?php echo $location['lat']; ?>,<?php echo $location['lng']; ?>&zoom=15&format=png&sensor=false&size=640x480&maptype=roadmap&visual_refresh=true&style=visibility:off&style=feature:road|element:geometry|visibility:simplified|color:0xefecec&style=feature:landscape|element:geometry|visibility:simplified|color:0xffffff&style=element:labels|visibility:on&markers=color:black|<?php echo $location['lat']; ?>,<?php echo $location['lng']; ?>"/>
<?php endif; ?>
@maxhawkins
maxhawkins / schotter.pde
Created January 11, 2011 03:30
Processing copy of Georg Nees's classic media art piece Schotter.
// Support Classes
class Vec3f {
float x, y, z;
Vec3f(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
void scale(float scale) {
this.x *= scale;
@Agnostic
Agnostic / git-pull-yosemite-fix
Last active May 8, 2018 11:43
/git-core/git-pull: line 11: git-sh-setup: No such file or directory (git pull Yosemite FIX)
// Open:
/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-pull
// Replace line 11 & 12
. git-sh-setup
. git-sh-i18n
// With this:
. /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-sh-setup
. /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-sh-i18n
@isGabe
isGabe / wp_custom_title_placeholder_text.php
Last active February 25, 2019 21:28
WordPress: Custom placeholder text for custom post type title input box #snippet #WordPress
<?php
/*
replacing the default "Enter title here" placeholder text in the title input box
with something more descriptive can be helpful for custom post types
place this code in your theme's functions.php or relevant file
source: http://flashingcursor.com/wordpress/change-the-enter-title-here-text-in-wordpress-963
*/
@bradvin
bradvin / get_current_post_type.php
Created March 5, 2012 18:48 — forked from mjangda/get_current_post_type.php
Get the current post_type context in the WordPress admin.
<?php
/**
* gets the current post type in the WordPress Admin
*/
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type )
return $post->post_type;