Skip to content

Instantly share code, notes, and snippets.

View necenzurat's full-sized avatar
🥺
I still hate JS

Costin Moise necenzurat

🥺
I still hate JS
View GitHub Profile
@necenzurat
necenzurat / gist:3520079
Created August 29, 2012 23:06
a script that changes all collations to utf8_general_ci
<?php
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@necenzurat
necenzurat / gist:3436746
Created August 23, 2012 13:45
google weather
<?php
/* shits */
header('Content-Type: text/html; charset=utf-8');
set_time_limit(0);
date_default_timezone_set("Europe/Bucharest");
function sopen($url_page){
$ua = "Googlebot/2.1 (+http://www.google.com/bot.html)"; // google :D
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_page);
@necenzurat
necenzurat / gist:3436686
Created August 23, 2012 13:39
accuweather
<?php
$curl = file_get_content("http://www.accuweather.com/ro/ro/bucuresti/bucharest/hourly.aspx");
/* Ora */
preg_match_all("(<div class=\"hbhItem textBold\">(.*?)</div>)s", $curl, $out);
//$ora = strtolower(trim($out[1][0]));
/* Temperatura */
@necenzurat
necenzurat / gist:2691845
Created May 14, 2012 04:55
Upload Media in WordPress Meta Boxes shamesly copied from http://www.wproots.com/upload-media-in-meta-boxes/
<?php
add_action('admin_menu', 'addMetaBox');
add_action('save_post', 'saveMetaData', 10, 2);
add_action('admin_head', 'embedUploaderCode');
//Define the metabox attributes.
$metaBox = array(
'id' => 'my-meta-box',
'title' => 'My Meta Box',
'page' => 'page',
@necenzurat
necenzurat / .gitignore
Created April 5, 2012 17:15 — forked from SaltwaterC/.gitignore
php cache curl
/cache/
@necenzurat
necenzurat / gist:2312544
Created April 5, 2012 17:04 — forked from anonymous/gist:2309745
Track Client-Side Errors with Google Analytics
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);
_gaq.push(['_setDomainName', 'yoursite.com']);
_gaq.push(['_addIgnoredRef', 'yoursite.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
@necenzurat
necenzurat / .gitignore
Created March 27, 2012 20:31 — forked from SaltwaterC/.gitignore
php cache curl
/cache/
@necenzurat
necenzurat / cache.php
Created March 27, 2012 12:25
php cache curl
<?php
/*
* Caching something with just one function
* Licensed under WTFPL
*/
function open($url){
// settings
$cachetime = (60 * 60 * 24 * 7); //one week
$where = "cache";
@necenzurat
necenzurat / dloader.php
Created December 27, 2011 14:31 — forked from mihneawalker/dloader.php
downloader
<?php
$fsource = fopen('x.txt','r');
function save_image($img,$fullpath){
$ch = curl_init ($img);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$rawdata=curl_exec($ch);
curl_close ($ch);
@necenzurat
necenzurat / get_the_fucking_linkedin
Created November 2, 2011 09:31
Scrape Linkedin Connection number
<?php
/* i hate haotik
LICENSE:
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.