Skip to content

Instantly share code, notes, and snippets.

View nclsjstnn's full-sized avatar

Nicolas Justiniano nclsjstnn

View GitHub Profile
@nclsjstnn
nclsjstnn / 64bitminecraft.sh
Created November 4, 2012 20:21
Making Minecraft use 64-bit Java on the Mac
#!/bin/bash
# Perform Backup of all the files
if [[ ! -d ~/Minecraft_Backups/ ]];then
echo "Creating backup directory ~/Minecraft_Backups/"
mkdir -p ~/Minecraft_Backups/
fi
tar -czf ~/Minecraft_Backups/`date +%Y%m%d`-backup.tgz /Applications/MinecraftSP.app
@nclsjstnn
nclsjstnn / gist:4983977
Created February 19, 2013 08:18
How to capture Google Maps large satelite footage using an iframe + screen grabber Change the "ll" value with a pair of lat/long coordinates, "z" for zoom, and the other variables in the iframe. You can look on the sharing button in Google Maps. Then take a screenshot of the entire page using paparazzi for mac or other screen grabber (some exten…
<html>
<head>
<title></title>
</head>
<style type="text/css">
body{
width: 100%;
margin: 100%;
padding: 0;
margin: 0;
@nclsjstnn
nclsjstnn / gist:5156091
Created March 13, 2013 20:56
EXPERIMENTAL WAY TO IMPORT A WORDPRESS BLOG INTO A SIMPLE RAIL SCAFFOLD
def import
require 'xmlrpc/client'
if params[:number_posts]
number_posts=params[:number_posts].to_i
loops=number_posts / 100
(1..loops.to_i).each do |i|
offset=100*i
connection = XMLRPC::Client.new2('http://www.nostalgic.cl/xmlrpc.php')
result = connection.call('wp.getPosts', 1, 'MEGO', 'mego123', {:number => 100, :offset => offset})
#imported_posts = result.length
@nclsjstnn
nclsjstnn / gist:5523211
Created May 6, 2013 03:26
Insert a new button to a form created with the gem "bootstrap-wysihtml5-rails" and manipulate it with bootbox.js https://github.com/jhollingworth/bootstrap-wysihtml5 http://bootboxjs.com
<script type="text/javascript">
$('#post_content').each(function(i, elem) {
$(elem).wysihtml5();
$(".wysihtml5-toolbar").append('<li id="target"><a class="btn" title="Insert gallery" tabindex="-1" href="javascript:;" unselectable="on"><i class="icon-th-large"></i></a></li>');
$("#target").click(function() {
bootbox.alert("Hello world!");
});
});
</script>
@nclsjstnn
nclsjstnn / gist:6358050
Created August 27, 2013 19:39
[PHP] Get the administrative number of a region from a Chilean address
//kinda oldschool but it could help you in some project in Chile
$address = urlencode(utf8_encode($_GET['address']));
$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='. $address .'&region=cl&sensor=false');
$output= json_decode($geocode);
for ( $i = 0; $i < count ( $output->results[0]->address_components ); $i ++ ) {
switch ( $output->results[0]->address_components[$i]->types[0] ) {
case "administrative_area_level_1":
$region = $output->results[0]->address_components[$i]->long_name;
break;
@nclsjstnn
nclsjstnn / instagrams.php
Created November 19, 2013 14:40
Get a list of instagrams refereed to a tag
<?php
function fetchData($url){
//edit here
$search = "mercadoconvite";
$access_token = "TU_TOKEN";
$count = "14";
//LET IT BE
$ch = curl_init();
@nclsjstnn
nclsjstnn / cache.rake
Last active August 10, 2016 16:10
Capistrano task to flush memcached cache.
namespace :cache do
desc 'Clear memcache'
task :clear => :environment do
Rails.cache.clear
end
end
@nclsjstnn
nclsjstnn / eventsPolyfill.js
Last active December 12, 2018 03:27
Event and CustomEvent ES6 polyfill solution for IE11
const eventPolyfill = () => {
if (typeof window.Event === 'function') {
return false;
}
const Event = (event) => {
const evt = document.createEvent('Event');
evt.initEvent(event, true, true);
return evt;
};

Keybase proof

I hereby claim:

  • I am jstnn on github.
  • I am justiniano (https://keybase.io/justiniano) on keybase.
  • I have a public key ASCJdzDjc5lHhozkLbLYJeFyt1fGpt9FFPistbuM7pnXKQo

To claim this, I am signing this object: