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
<?php | |
$query = $_GET['query']; | |
$url = "http://en.wikipedia.org/w/api.php?action=parse&page=$query&format=json&prop=text§ion=0"; | |
$ch = curl_init($url); | |
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt ($ch, CURLOPT_USERAGENT, "TestScript"); // required by wikipedia.org server; use YOUR user agent with YOUR contact information. (otherwise your IP might get blocked) | |
$c = curl_exec($ch); |
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
# over writing the conflict slug | |
module FriendlyId | |
module Slugged | |
def resolve_friendly_id_conflict(candidates) | |
candidates.first + friendly_id_config.sequence_separator + SecureRandom.hex(3) | |
end | |
end | |
end |
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 you want your form to be submitted when user selects something, use: | |
:onchange => "this.form.submit();" | |
For example: | |
select_tag "people", "<option>David</option>", :onchange => "this.form.submit();" |
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
@mixin box-shadow($top, $left, $blur, $size, $color, $inset: false) { | |
@if $inset { | |
-webkit-box-shadow:inset $top $left $blur $size $color; | |
-moz-box-shadow:inset $top $left $blur $size $color; | |
box-shadow:inset $top $left $blur $size $color; | |
} @else { | |
-webkit-box-shadow: $top $left $blur $size $color; | |
-moz-box-shadow: $top $left $blur $size $color; | |
box-shadow: $top $left $blur $size $color; | |
} |
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
<?php | |
/** | |
* Convert a comma separated file into an associated array. | |
* The first row should contain the array keys. | |
* | |
* Example: | |
* | |
* @param string $filename Path to the CSV file | |
* @param string $delimiter The separator used in the file | |
* @return array |
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
<?php | |
/** | |
* File class | |
* | |
* @package Molajo | |
* @copyright 2013 Amy Stephen. All rights reserved. | |
* @license MIT, GPL v2 or later | |
*/ | |
namespace Molajo; |
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
# encoding: utf-8 | |
class DisplayPhotoUploader < CarrierWave::Uploader::Base | |
# Include RMagick or MiniMagick support: | |
include CarrierWave::RMagick | |
include CarrierWave::Processing::RMagick | |
# include CarrierWave::MiniMagick | |
include CarrierWave::ImageOptimizer |
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
# Create a new Rails Project | |
rails new <project-name> -d mysql | |
# Run Bundler | |
bundle install | |
# Database Initiation | |
rake db:create | |
# Dump SQL file into MySQL |
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
/ Form excerpt | |
= f.button t(".save"), class: "btn" | |
= f.button t(".publish"), class: "btn", name: "publish" | |
= f.button t(".test"), class: "btn", name: "test" |
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
<script type="text/javascript"> | |
var map; | |
var geocoder; | |
var service; | |
var mapOptions = { | |
center: new google.maps.LatLng(12.971599, 77.594563), | |
zoom: 14, | |
mapTypeId: google.maps.MapTypeId.ROADMAP |