Skip to content

Instantly share code, notes, and snippets.

View haleyngonadi's full-sized avatar

haley. haleyngonadi

  • Canada
View GitHub Profile
@ivanbruel
ivanbruel / UIImage+UIColor
Created September 29, 2015 18:14
Animate crossfade UIColor and UIImage with SDWebImage
//
// UIImage+UIColor.swift
//
import UIKit
extension UIImage {
class func imageWithColor(color: UIColor) -> UIImage {
let rect = CGRectMake(0.0, 0.0, 1.0, 1.0)
UIGraphicsBeginImageContext(rect.size)
@AmirHossein
AmirHossein / coordinatestoname.js
Last active December 25, 2023 11:15
Get City and Country name by coordinates via Google Maps api
// Demo: http://jsfiddle.net/xuyp8qb5/
// Note: You need Google Map API Key to run demo; bit.ly/2pBgToW
var latlng;
latlng = new google.maps.LatLng(40.730885, -73.997383); // New York, US
//latlng = new google.maps.LatLng(37.990849233935194, 23.738339349999933); // Athens, GR
//latlng = new google.maps.LatLng(48.8567, 2.3508); // Paris, FR
//latlng = new google.maps.LatLng(47.98247572667902, -102.49018710000001); // New Town, US
//latlng = new google.maps.LatLng(35.44448406385493, 50.99001635390618); // Parand, Tehran, IR
//latlng = new google.maps.LatLng(34.66431108560504, 50.89113940078118); // Saveh, Markazi, IR
@adrianorsouza
adrianorsouza / sublime-command-line.md
Last active September 26, 2023 16:26
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@Phonbopit
Phonbopit / AndroidManifest.xml
Last active March 6, 2019 07:55
Android GSON with Custom ListView Tutorial , Article Link: http://devahoy.com/2014/05/android-custom-listview-with-gson-tutorial/
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.devahoy.sample.ahoygson" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
@tjhole
tjhole / WORDPRESS: Base64 Image to Wordpress Uploads directory
Created May 9, 2014 12:35
WORDPRESS: Base64 Image to Wordpress Uploads directory
function tattoo_submit() {
if (isset($_POST["addtattoo"])) {
$title = "Tattoo : ". $_POST["tatooInput"];
$my_post = array(
'post_title' => $title,
'post_status' => 'publish',
'post_author' => 1,
@oguzhanaslan
oguzhanaslan / ResizingImageJquery.js
Last active February 23, 2020 08:08
Resizing image with jQuery
$(document).ready(function(){
$('.img-responsive').each(function() {
var maxWidth = 180; // Max width for the image
var maxHeight = 3000; // Max height for the image
var ratio = 0; // Used for aspect ratio
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
// Check if the current width is larger than the max
@andkon
andkon / Custom cell with UITextField
Last active August 24, 2016 15:23
Custom cell with UITextField - for use with storyboards
Storyboard configuration:
1. Make a cell.
2. Give it a custom class of YourCell
3. Drag a label onto the cell, give the label a tag of 100. Configure and arrange as necessary.
4. Drag a text field onto the cell, give the textField a tag of 101. Configure and arrange as necessary.
@danharper
danharper / background.js
Last active March 30, 2024 18:25
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@HoundstoothSTL
HoundstoothSTL / anchor-scroll-with-offset.js
Created May 3, 2013 15:43
Anchor scroll with fixed header offset
(function($) {
$('a[href*=#]:not([href=#])').click(function()
{
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname)
{
var target = $(this.hash),
headerHeight = $(".primary-header").height() + 5; // Get fixed header height
@jareware
jareware / SCSS.md
Last active April 23, 2024 22:13
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso