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
import requests | |
resp = requests.get('https://url.com/api/endpoint').json() | |
data = resp['data'] | |
while resp['next_page_url']: | |
resp = requests.get(resp['next_page_url']).json() | |
data.extend(resp['data']) |
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(! function_exists('nl2p')) { | |
function nl2p($str) { | |
$arr = explode("\n", $str); | |
$out = ''; | |
for($i = 0; $i < count($arr); $i++) { | |
if(strlen(trim($arr[$i])) > 0) | |
$out .= '<p>' .trim($arr[$i]) . '</p>'; | |
} |
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(! function_exists('split_name')) { | |
function split_name($name) { | |
$parts = array(); | |
while ( strlen( trim($name)) > 0 ) { | |
$name = trim($name); | |
$string = preg_replace('#.*\s([\w-]*)$#', '$1', $name); | |
$parts[] = $string; | |
$name = trim( preg_replace('#'.$string.'#', '', $name ) ); | |
} |
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
use Illuminate\Pagination\LengthAwarePaginator; | |
use Illuminate\Pagination\Paginator; | |
use Illuminate\Support\Collection; | |
if(! function_exists('paginate')) | |
{ | |
function paginate($items, $perPage = 15, $page = null) | |
{ | |
$page = $page ?: (Paginator::resolveCurrentPage() ?: 1); | |
$items = $items instanceof Collection ? $items : Collection::make($items); |
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
# remove specific file from git cache | |
git rm --cached filename | |
# remove all files from git cache | |
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore is now working" |
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
{ | |
"vars": { | |
"@gray-base": "#000", | |
"@gray-darker": "lighten(@gray-base, 13.5%)", | |
"@gray-dark": "lighten(@gray-base, 20%)", | |
"@gray": "lighten(@gray-base, 33.5%)", | |
"@gray-light": "lighten(@gray-base, 46.7%)", | |
"@gray-lighter": "lighten(@gray-base, 93.5%)", | |
"@brand-primary": "darken(#6fb353, 6.5%)", | |
"@brand-success": "#5cb85c", |
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
/** CHANGE FEATURED IMAGE META BOX CONTENT **/ | |
add_filter( 'admin_post_thumbnail_html', 'add_featured_image_instruction'); | |
function add_featured_image_instruction( $content ) { | |
$content .= '<p><i>The featured image should be 1920x665 pixels</i></p>'; | |
return $content; | |
} |
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
div:before { | |
position: absolute; | |
content: " "; | |
display: block; | |
left: 0; | |
top: 0; | |
border-right: 50px solid #fff; | |
border-bottom: 50px solid transparent; | |
width: 50% !important; | |
height: 0; |
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 gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
gulp.task('styles', function() { | |
gulp.src('sass/**/*.scss') | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(gulp.dest('./')); | |
}); | |
//Watch task |
NewerOlder