Skip to content

Instantly share code, notes, and snippets.

View kexoth's full-sized avatar

Aleksandar Kex Trpeski kexoth

View GitHub Profile
local muteButton=ui.newButton(muteGroup,"mute.png",display.contentWidth-50, display.contentHeight-430, 30, 30, function(event)
if clicked==event.action then
for i = 1, audio.totalChannels, 1 do
print("Volume:" .. audio.getVolume({ channel = i }) .. " Channel:" .. i)
if audio.getVolume({ channel = i }) == 0 then
audio.setVolume(1, { channel = i })
GCClient *apiClient = [GCClient sharedClient];
[apiClient setAuthorizationHeaderWithToken:@"YOUR_TOKEN"];
[GCServiceAlbum getAlbumWithID:@(YOUR_ALBUM_ID) success:^(GCResponseStatus *responseStatus, GCAlbum *album) {
[album importAssetsFromURLs:@[@"YOUR_VIDEO_URL"] success:^(GCResponseStatus *responseStatus, NSArray *assets, GCPagination *pagination) {
/*
Imported the asset, do something.
*/
<article class="socialmediaicons">
<span class="title"> Join the movement: </span>
<ul class="group">
<% appdata.social.forEach(function(item) { %>
<li>
<a href="<%= item.url %>">
<img class="icon" src="<%= item.imageURL %>" alt="icon for <%= item.shortname %>" />"
</a>
</li>
<% }); %>
function solution(N, A) {
var counters = new Uint32Array(N),
max = 0,
gMax = 0;
for (i = 0; i < A.length; i++) {
var value = A[i];
function solution(A) {
var cars0 = 0,
cars1 = 0,
combinations = 0;
for (var i = A.length - 1; i >= 0; i--) {
if (A[i] === 0) {
function solution(A, B, K) {
return (Math.floor(B/K) - ((A <= 1) ? 0 : Math.floor((A-1)/K))) + ((A === 0)?1:0);
}
@kexoth
kexoth / delay
Created October 21, 2015 19:25
Swift Delay Block
func delay(delay: Double, closure: ()->()) {
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
Int64(delay * Double(NSEC_PER_SEC))
),
dispatch_get_main_queue(),
closure
)
}
@kexoth
kexoth / form.html.eex
Created April 21, 2016 17:15
Ecto Arc S3 Image Uploader Not Working
<%= form_for @changeset, @action, [multipart: true], fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<div class="form-group">
<%= label f, :title, class: "control-label" %>
<%= text_input f, :title, class: "form-control" %>
@kexoth
kexoth / WrappedProgram.elm
Last active April 16, 2018 14:41
This is a wrapped Elm `Html.program` in order to add additional logic around it.
module Main exposing (..)
import Html exposing (Html, text)
type Msg msg
= Internal
| Wrapped msg
@kexoth
kexoth / Console.elm
Created August 14, 2017 00:38
Elmo-8 Console reimplementation with better wrapping, WIP
module Elmo8.Console exposing (Command, putPixel, print, boot, Config, sprite)
{-| The ELMO-8 Fantasy Console
This is a PICO-8 inspired fantasy "console". This isn't really a console emulator but a simple graphics and game library for creating 8-bit retro games.
# Initialization
To start up the console you need to do a little bit of configuration (the pattern matches Elm's normal model/view/update):