Skip to content

Instantly share code, notes, and snippets.

View amirkheirabadi73's full-sized avatar
🙃
confused about future

Amir amirkheirabadi73

🙃
confused about future
View GitHub Profile
{
jack: 20,
amir: 22,
ali: 15,
};
sortObject((persons) => {
var sortable = [];
for (var person in persons) {
sortable.push([person, persons[person]]);
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@amirkheirabadi73
amirkheirabadi73 / interval.php
Created March 4, 2014 08:30
SetInterval In php
function setInterval($func = null, $interval = 0, $times = 0){
if( ($func == null) || (!function_exists($func)) ){
throw new Exception('We need a valid function.');
}
/*
usleep delays execution by the given number of microseconds.
JavaScript setInterval uses milliseconds. microsecond = one
millionth of a second. millisecond = 1/1000 of a second.
Multiplying $interval by 1000 to mimic JS.
@amirkheirabadi73
amirkheirabadi73 / Post Thumbnails
Created September 21, 2013 14:20
Post Thumbnails
Sample Functions.php:
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150, true ); // default Post Thumbnail dimensions (cropped)
// additional image sizes
// delete the next line if you do not need additional image sizes
add_image_size( 'category-thumb', 300, 9999 ); //300 pixels wide (and unlimited height)
}
@amirkheirabadi73
amirkheirabadi73 / زمینه دلخواه
Created September 21, 2013 14:15
زمینه دلخواه
<?php $link = get_post_meta($post->ID, 'link', true); ?>
<?php echo $link; ?>
@amirkheirabadi73
amirkheirabadi73 / Post Loop
Created September 21, 2013 12:54
Post Loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_title( ); ?>
<?php the_content( ); ?>
<?php endwhile; ?>
<?php else: ?>
@amirkheirabadi73
amirkheirabadi73 / Custome Menu
Created September 21, 2013 12:21
Register Custome Menu For Wordpress Themplate
in Functions.php
function register_my_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
'extra-menu' => __( 'Extra Menu' )
)
);
}
@amirkheirabadi73
amirkheirabadi73 / Back Ground App With KV
Created July 14, 2013 07:54
BackGround For App WIth Convas Rectangle in Laout
from kivy.app import App
from kivy.lang import Builder
root = Builder.load_string(’’’
FloatLayout:
canvas.before:
Color:
rgba: 0, 1, 0, 1
Rectangle:
# self here refers to the widget i.e FloatLayout
pos: self.pos
@amirkheirabadi73
amirkheirabadi73 / Animation Scatter
Created July 13, 2013 06:45
Animation The Scatter
from kivy.app import App
from kivy.interactive import InteractiveLauncher
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.scatter import Scatter
from kivy.graphics import Color, Rectangle ,Ellipse ,Bezier ,BorderImage
from kivy.animation import Animation as A
class myApp(App):
def build(self):
@amirkheirabadi73
amirkheirabadi73 / Scatter Wiget
Created July 13, 2013 05:15
Scatter is used to build interactive widgets that can be translated, rotated and scaled with two or more fingers on a multitouch system.
from kivy.app import App
from kivy.interactive import InteractiveLauncher
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.scatter import Scatter
from kivy.graphics import Color, Rectangle ,Ellipse ,Bezier ,BorderImage
class myApp(App):
def build(self):
mywid = Widget()