Skip to content

Instantly share code, notes, and snippets.

View karloscarweber's full-sized avatar
📱
Building

Karl Weber karloscarweber

📱
Building
View GitHub Profile
@JunaidQadirB
JunaidQadirB / Uploader.php
Created July 31, 2011 17:13
The Uploader class is a simple php script that makes file uploads a bit easier.
/**
*
* The Uploader class is a simple php script that makes file
* uploads a bit easier.
* @author Junaid Qadir Baloch (shekhanzai.baloch@gmail.com)
* @version 0.1 10:18 PM 7/30/2011
*
*/
class Uploader
{
@karloscarweber
karloscarweber / jquery.function.js
Created April 15, 2012 00:34
A Jquery Function Extention boilerplate
// Jquery Function BoilerPlate for newbies
//
//
// Surrounded by parentheses to allow anonymous founcitons on the inside
(function($){ // pass the jquery pseudo variable "$" into the function in order to create it's awesomeness.
$.fn.yourFucntion = function(userConfig) {
// please note, the "this" variable in the current scope will refer to the
@awesome
awesome / jQuery-non-AJAX-POST.coffee
Created October 25, 2012 17:42
jQuery non-AJAX POST
# function submit(action, method, values) {
# var form = $('<form/>', {
# action: action,
# method: method
# });
# $.each(values, function() {
# form.append($('<input/>', {
# type: 'hidden',
# name: this.name,
# value: this.value
@rakeshtembhurne
rakeshtembhurne / render_view_as_variable.php
Created July 19, 2013 10:10
CakePHP: Render view in a variable inside controlller
<?php
$view = new View($this, false);
$view->set(compact('some', 'vars'));
$html = $view->render('view_name');
@calebd
calebd / ArrayHelpers.swift
Last active November 4, 2022 15:17
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
@nicklockwood
nicklockwood / Hacking UIView Animation Blocks.md
Last active January 12, 2024 06:15
This article was originally written for objc.io issue 12, but didn't make the cut. It was intended to be read in the context of the other articles, so if you aren't familiar with concepts such as CALayer property animations and the role of actionForKey:, read the articles in that issue first.

Hacking UIView animation blocks for fun and profit

In this article, I'm going to explore a way that we can create views that implement custom Core Animation property animations in a natural way.

As we know, layers in iOS come in two flavours: Backing layers and hosted layers. The only difference between them is that the view acts as the layer delegate for its backing layer, but not for any hosted sublayers.

In order to implement the UIView transactional animation blocks, UIView disables all animations by default and then re-enables them individually as required. It does this using the actionForLayer:forKey: method.

Somewhat strangely, UIView doesn't enable animations for every property that CALayer does by default. A notable example is the layer.contents property, which is animatable by default for a hosted layer, but cannot be animated using a UIView animation block.

@renaudbedard
renaudbedard / WaveformDisplay.cs
Created September 25, 2014 03:37
Waveform visualizer
using System;
using System.Collections;
using System.Threading;
using UnityEngine;
class WaveformDisplay : MonoBehaviour
{
public Tracker Tracker;
public int LineSegments;
//
// ViewController.swift
// Tetris
//
// Created by Julius Parishy on 11/19/14.
// Copyright (c) 2014 Julius Parishy. All rights reserved.
//
import UIKit
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1